Error Prone 2.0.14 release

99 views
Skip to first unread message

Nicholas Glorioso

unread,
Oct 31, 2016, 7:27:46 PM10/31/16
to error-prone-announce, error-pro...@googlegroups.com
We are pleased to announce the release of version 2.0.14 of Error Prone! It is available for download from Maven Central.

Checks enabled by default with this release:
  • Errors:
    • JavaxInjectOnAbstractMethod - Error when abstract (or default interface) methods are annotated with @javax.inject.Inject. Injection frameworks don't inject these methods.
    • FunctionalInterfaceMethodChanged - When a @FunctionalInterface overrides another @FunctionalInterface while changing its behavior. This is rife for errors when used with lambdas.
    • PackageInfo - When one declares any types inside package-info.java
    • UnnecessaryTypeArgument - Calling a method that doesn't declare a generic type with a type argument: System.out.<String>println();
  • Warnings:
    • InjectOnConstructorOfAbstractClass - Warning when @Inject is used on constructors of an abstract class
    • NarrowingCompoundAssignment - Finds instances where precision loss occurs with compound assignment (int x = 42; x*= 2.0 narrows from double to int)
    • FunctionalInterfaceClash - When a class defines two methods with the same name whose call sites are ambiguous when being passed lambdas
    • AmbiguousMethodReference - When a class defines two methods that would be ambiguous when used as a method reference
    • InputStreamSlowMultibyteRead - Subclasses of InputStream that don't override read(byte[], int, int) can be slow when reading multiple bytes (the read() method is just used over and over again).
    • TruthConstantAsserts - When using Truth test assertions assertThat(SOME_CONSTANT).isEqualTo(myTestThing) is wrong. It should be reversed
New experimental checks:
Other changes:
  • CompileTimeConstant: Recognize effectively-final parameters/variables when possible, not just those annotated as final.
  • DefaultCharset - Recognize more methods that implicitly use the default charset (PrintWriter)
  • InsecureCryptoUsage - Recognize usage of Diffie-Hellman with prime fields, and usage of DSA for digital signatures
  • BoxedPrimitiveConstructor - Improve suggested fixes in contexts when autoboxing is combined with widening,
  • ConstantField
    • Treat enums as effectively constant for purposes of declaring whether or not a field should be considered a constant. 
    • Recognize C++ kStyleConstants to rewrite to STYLE_CONSTANTS instead of K_STYLE_CONSTANTS
  • TruthSelfEquals - Better-handle methods that return custom subject instances
  • ArgumentParameterSwap - Major rework of the checker. While the intent is the same, the mechanism by which arguments are matched to parameters has been changed dramatically.
  • ReturnValueIgnored - Detect if the return value of methods on types in java.util.function are ignored (except for Consumers)
  • MissingFail - Will now trigger if the catch block in a try/fail/catch pattern has any method named verify*
  • Added two new flags: 
    • -XepAllErrorsAsWarnings, to demote all suppressible errors to warnings. This is helpful for first-time compiles over codebases, to see all of the issues so one can fix them at once
    • -XepAllDisabledChecksAsWarnings, to eagerly enable every check that is normally disabled by default. It is more likely to cause errors from more unstable checks. Those unstable checks can be further disabled like normal
  • New experimental feature: Patch in place!
    • More documentation to come, but by adding -XepPatch:IN_PLACE, Error Prone will apply all of the suggested fixes directly to your source. One can even generate a patch file (see example maven pom configured this way)
Reply all
Reply to author
Forward
0 new messages