-
|
It seems that error prone is included in the list of mutators for However, if I add the following spotless {
java {
removeUnusedImports()
cleanthat()
.sourceCompatibility("21")
.addMutator("ComparisonWithNaN")
}
}or even spotless {
java {
removeUnusedImports()
cleanthat()
.sourceCompatibility("21")
.addMutator("ErrorProne")
.addMutator("ComparisonWithNaN")
}
}to my gradle build file, then run import static java.lang.Double.NaN;
class ShortSet {
public static void main (String[] args) {
Set<Short> s = new HashSet<>();
for (short i = 0; i < 100; i++) {
s.add(i);
s.remove(i - 1);
}
double d = 0.0;
if (true)
new Exception();
System.out.println(d == NaN);
}
}However, if I install Errorprone manually through its plugin: plugins {
id("net.ltgt.errorprone") version "3.1.0"
}
dependencies {
errorprone("com.google.errorprone:error_prone_core:2.25.0")
}and run ./gradlew check
> Task :compileJava FAILED
[redacted]: warning: [ModifiedButNotUsed] A collection or proto builder was created, but its values were never accessed.
Set<Short> s = new HashSet<>();
^
(see https://errorprone.info/bugpattern/ModifiedButNotUsed)
Did you mean to remove this line?
[redacted]: error: [CollectionIncompatibleType] Argument 'i - 1' should not be passed to this method; its type int is not compatible with its collection's type argument Short
s.remove(i - 1);
^
(see https://errorprone.info/bugpattern/CollectionIncompatibleType)
[redacted]: error: [DeadException] Exception created but not thrown
new Exception();
^
(see https://errorprone.info/bugpattern/DeadException)
Did you mean 'throw new Exception();'?
[redacted]: error: [EqualsNaN] == NaN always returns false; use the isNaN methods instead
System.out.println(d == NaN);
^
(see https://errorprone.info/bugpattern/EqualsNaN)
Did you mean 'System.out.println(Double.isNaN(d));'?
3 errors
1 warningWhat am I missing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Probably it's about issues that |
Beta Was this translation helpful? Give feedback.
Probably it's about issues that
errorpronecan fix vs those it can't. Spotless is focused on autofixable issues, it might be that cleanthat hasn't integrated the parts oferrorpronewhicherrorproneitself can't fix automatically.