-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Fix some compiler warnings in sdks/java/core #5319
Conversation
Run Dataflow ValidatesRunner |
86801ab
to
ec0e9ac
Compare
R: @kennknowles |
Yes, please. My favorite compiler flag :-) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one readability nit.
@@ -129,14 +129,14 @@ | |||
} | |||
|
|||
private static byte encodedByte(boolean isFirst, boolean isLast, Timing timing) { | |||
byte result = 0x0; | |||
byte result = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What was the warning here? TBH my preference would even be to use a binary literal 0b0
here but more importantly the lines below would be the very readable sequence making the logic obvious:
0b0001
0b0010
0b0100
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NarrowingCompoundAssignment. The trouble is that Java doesn't have a way to specify a byte literal, so 0x1 is a treated as an integer and then triggers the ErrorProne warning on |=
operator.
There's no reason we can't use 0b00
etc. Updated.
Java pre-commits are failing; seems that this change has somehow triggered the full wrath of ErrorProne: https://scans.gradle.com/s/whoprvzcdtcya/console-log?task=:beam-sdks-java-core:compileJava#L106 Not sure why these are being treated as failures, but let's see how much work it is to just fix the rest.. |
431e0d0
to
c233139
Compare
Ok, so I went and fixed all ErrorProne issues across SDK core such that we can enable @kennknowles PTAL |
Wow, that's amazing! I never thought we'd get there. |
retest this please |
run java precommit |
The failure seems unlikely to be related, but curious anyhow. |
e2ccc08
to
ddbaf49
Compare
retest this please |
1 similar comment
retest this please |
13697e3
to
be72586
Compare
Run Python PreCommit |
All green! @kennknowles PTAL |
Great! Would you mind curating the commits now that it is g2g? |
This clears compiler warnings about SuppressFBWarnings for dependent libaries using the latest version: warning: Cannot find annotation method 'value()' in type 'SuppressWarnings': class file for edu.umd.cs.findbugs.annotations.SuppressWarnings not found
* http://errorprone.info/bugpattern/AssertEqualsArgumentOrderChecker * http://errorprone.info/bugpattern/AssertionFailureIgnored * http://errorprone.info/bugpattern/BoxedPrimitiveConstructor * http://errorprone.info/bugpattern/CanonicalDuration * http://errorprone.info/bugpattern/CatchFail * http://errorprone.info/bugpattern/ClassCanBeStatic * http://errorprone.info/bugpattern/ClassNewInstance * http://errorprone.info/bugpattern/DefaultCharset * http://errorprone.info/bugpattern/DoubleBraceInitialization * http://errorprone.info/bugpattern/EqualsHashCode * http://errorprone.info/bugpattern/EqualsIncompatibleType * http://errorprone.info/bugpattern/FutureReturnValueIgnored * http://errorprone.info/bugpattern/ImmutableEnumChecker * http://errorprone.info/bugpattern/IntLongMath * http://errorprone.info/bugpattern/JavaLangClash * http://errorprone.info/bugpattern/JdkObsolete * http://errorprone.info/bugpattern/MissingOverride * http://errorprone.info/bugpattern/MutableConstantField * http://errorprone.info/bugpattern/NarrowingCompoundAssignment * http://errorprone.info/bugpattern/OperatorPrecedence * http://errorprone.info/bugpattern/ReferenceEquality * http://errorprone.info/bugpattern/ShortCircuitBoolean * http://errorprone.info/bugpattern/StringSplitter * http://errorprone.info/bugpattern/TypeParameterUnusedInFormals * http://errorprone.info/bugpattern/UnsynchronizedOverridesSynchronized
This field isn't retained on proto translation, and shouldn't be used when checking for equality of WindowingStrategy instances.
be72586
to
3f7ee68
Compare
Rebased with no other changes. |
PTAL @kennknowles |
The project is not yet ErrorProne-clean, but if we can get it there I recommend adding the
-Werror
compiler flag to treat warnings as errors.