Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

android-interop-testing spews lots of warnings #6866

Closed
ejona86 opened this issue Mar 27, 2020 · 2 comments · Fixed by #6870
Closed

android-interop-testing spews lots of warnings #6866

ejona86 opened this issue Mar 27, 2020 · 2 comments · Fixed by #6870
Assignees
Milestone

Comments

@ejona86
Copy link
Member

ejona86 commented Mar 27, 2020

For the generated code, we should probably disable the warning, like we do elsewhere:

options.compilerArgs += [
"-Xlint:-cast"
]
options.errorprone.excludedPaths = ".*/build/generated/source/proto/.*"

The rest look like they'll need changes, but I just too a cursory glance.

> Task :grpc-android-interop-testing:compileDebugJavaWithJavac
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/EmptyProtos.java:112: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:286: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:567: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:891: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:1715: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:2908: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:3584: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:4011: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:4411: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:4848: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:5548: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:6120: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:6415: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:6757: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:7141: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Messages.java:7621: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Metrics.java:354: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Metrics.java:774: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/build/generated/source/proto/debug/java/io/grpc/testing/integration/Metrics.java:1010: warning: [cast] redundant cast to Builder
      return (Builder) DEFAULT_INSTANCE.createBuilder(prototype);
             ^
grpc-java/android-interop-testing/src/main/java/io/grpc/android/integrationtest/InteropTask.java:72: warning: [Finally] If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.
        throw ex;
        ^
    (see https://errorprone.info/bugpattern/Finally)
grpc-java/android-interop-testing/src/main/java/io/grpc/android/integrationtest/InteropTask.java:74: warning: [Finally] If you return or throw from a finally, then values returned or thrown from the try-catch block will be ignored. Consider using try-with-resources instead.
        throw new RuntimeException(ex);
        ^
    (see https://errorprone.info/bugpattern/Finally)
grpc-java/interop-testing/src/main/java/io/grpc/testing/integration/AbstractInteropTest.java:294: warning: [UnnecessaryAnonymousClass] Implementing a functional interface is unnecessary; prefer to implement the functional interface method directly and use a method reference instead.
  private final ClientInterceptor tracerSetupInterceptor = new ClientInterceptor() {
                                  ^
    (see https://errorprone.info/bugpattern/UnnecessaryAnonymousClass)
  Did you mean 'private  <ReqT, RespT> ClientCall<ReqT, RespT> tracerSetupInterceptor('?
22 warnings
@voidzcy
Copy link
Contributor

voidzcy commented Mar 27, 2020

Yes, I realized that. I tried to let protobuf team know if they can fix this in javalite, but seems no one has replied me. I am going to disable the warning.

The couple of (there were more, fixed one or two easy ones in #6829) errorprone warnings in android-interop-testing do not have obvious solutions. I will try again to get rid of them.

@ejona86
Copy link
Member Author

ejona86 commented Mar 27, 2020

If we disagree with errorprone on a particular line we can always add a suppression, like @SuppressWarnings("Finally"). If we agree with errorprone but can't quite figure out what to do, we can suppress it and file a bug to track it (with a link to the issue at the suppression).

If an errorprone check just doesn't seem appropriate for us (like maybe Finally, given we haven't considered ourselves able to use try-with-resources), then we can disable that check completely with -Xep.

The important thing is to keep the build clean, because new warnings are really hard to spot in a sea of noise.

@ejona86 ejona86 modified the milestones: Next, 1.29 Mar 31, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants