Prior to v2.50.0, Varifier would encourage primitives to be assigned using var and most of these cases were eliminated by preferring VarWithPrimitive. However, when a cast is used then the two rules conflict, e.g. ??? sign = (int) Math.signum(dw * dHr); violates either rule when given an int or var.
VarWithPrimitive
> Task :simulator:compileJava FAILED
/Users/ben/projects/caffeine/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/CorrelationClimber.java:84: warning: [VarWithPrimitive] Avoid using `var` with primitive types. Explicit primitive type names are short and clear, and `var` provides no benefit in readability while potentially hiding the type.
var sign = (int) Math.signum(dw * dHr);
^
(see https://errorprone.info/bugpattern/VarWithPrimitive)
Did you mean 'int sign = (int) Math.signum(dw * dHr);'?
error: warnings found and -Werror specified
1 error
1 warning
> Task :simulator:processTestResources NO-SOURCE
> Task :caffeine:compileTestJava
/Users/ben/projects/caffeine/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java:2611: warning: [VarWithPrimitive] Avoid using `var` with primitive types. Explicit primitive type names are short and clear, and `var` provides no benefit in readability while potentially hiding the type.
var cappedSampleSize = (int) (baseSampleSize * SMALL_CACHE_SAMPLE_RATIO_CAP);
^
(see https://errorprone.info/bugpattern/VarWithPrimitive)
Did you mean 'int cappedSampleSize = (int) (baseSampleSize * SMALL_CACHE_SAMPLE_RATIO_CAP);'?
error: warnings found and -Werror specified
1 error
1 warning
Varifier
> Task :simulator:compileJava
/Users/ben/projects/caffeine/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/CorrelationClimber.java:84: warning: [Varifier] Consider using `var` here to avoid boilerplate.
int sign = (int) Math.signum(dw * dHr);
^
(see https://errorprone.info/bugpattern/Varifier)
Did you mean 'var sign = (int) Math.signum(dw * dHr);'?
error: warnings found and -Werror specified
1 error
1 warning
> Task :simulator:compileJava FAILED
> Task :simulator:processTestResources NO-SOURCE
> Task :caffeine:compileTestJava
/Users/ben/projects/caffeine/caffeine/src/test/java/com/github/benmanes/caffeine/cache/BoundedLocalCacheTest.java:2611: warning: [Varifier] Consider using `var` here to avoid boilerplate.
int cappedSampleSize = (int) (baseSampleSize * SMALL_CACHE_SAMPLE_RATIO_CAP);
^
(see https://errorprone.info/bugpattern/Varifier)
Did you mean 'var cappedSampleSize = (int) (baseSampleSize * SMALL_CACHE_SAMPLE_RATIO_CAP);'?
error: warnings found and -Werror specified
1 error
1 warning
Prior to v2.50.0,
Varifierwould encourage primitives to be assigned usingvarand most of these cases were eliminated by preferringVarWithPrimitive. However, when a cast is used then the two rules conflict, e.g.??? sign = (int) Math.signum(dw * dHr);violates either rule when given anintorvar.VarWithPrimitive
Varifier