“It automates the process of checking Java code to spare humans of this boring (but important) task. This makes it ideal for projects that want to enforce a coding standard.”
[ant:checkstyle] [WARN] ~/code/experimentation/src/ main/java/ae/droidcon/checkstyle/Example.java:5:1: Line contains a tab character. [FileTabCharacter]
[ant:checkstyle] [WARN] ~/code/experimentation/src/ main/java/ae/droidcon/checkstyle/Example.java:3:32: GenericWhitespace '<' is followed by whitespace. [GenericWhitespace]
[ant:checkstyle] [WARN] ~/code/experimentation/src/ main/java/ae/droidcon/checkstyle/Example.java:4:23: '(' is preceded with whitespace. [MethodParamPad]
[ant:checkstyle] [WARN] ~/code/experimentation/src/ main/java/ae/droidcon/checkstyle/Example.java:5:11: Assignment of parameter 'value' is not allowed. [ParameterAssignment]
[ant:checkstyle] [WARN] ~/code/experimentation/src/ main/java/ae/droidcon/checkstyle/Util.java:3:1: Utility classes should not have a public or default constructor. [HideUtilityClassConstructor]
~/code/experiments/app/src/main/java/ae/droidcon/lint/ BoringActivity.kt:14: Error: Unexpected implicit cast to ImageButton: layout tag was Button [WrongViewCast] val button: ImageButton = findViewById(R.id.button)
~/code/experiments/app/src/main/java/ae/droidcon/ lint/BoringActivity.kt:19: Error: Should pass resolved color instead of resource id here: getResources().getColor(R.color.accent_material_dark) [ResourceAsColor] R.color.accent_material_dark)
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/Util.java:9: error: [UnusedCollectionModifiedInPlace] Collection is modified in place, but the result is not used Collections.sort(new ArrayList<>(foos)); ^ (see http://errorprone.info/bugpattern/ UnusedCollectionModifiedInPlace)
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/Carb.java:7: error: [MisusedWeekYear] Use of "YYYY" (week year) in a date pattern without "ww" (week in year). You probably meant to use "yyyy" (year) instead. return new SimpleDateFormat("YYYY-MM-dd"); ^ (see http://errorprone.info/bugpattern/ MisusedWeekYear) Did you mean 'return new SimpleDateFormat("yyyy- MM-dd");'?
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/Finder.java:7: error: [CollectionIncompatibleType] Argument '1' should not be passed to this method; its type int is not compatible with its collection's type argument Long return (values.contains(1)); ^ (see http://errorprone.info/bugpattern/ CollectionIncompatibleType)
public class PostApocolypse { private final Set theLastOfUs = World.getRemainingHumans(); private volatile int zombies = 9001; public void fightZombies() { zombies--; } }
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/PostApocolypse.java:9: warning: [NonAtomicVolatileUpdate] This update of a volatile variable is non-atomic zombies--; ^ (see http://errorprone.info/bugpattern/ NonAtomicVolatileUpdate) 1 warning
public String getFaction(int version) { String result; switch (version) { case FALLOUT_2: case FALLOUT_NEW_VEGAS: result = "New California Rangers"; break; case FALLOUT_3: result = "The Enclave"; break; case FALLOUT_4: result = "Institute"; default: result = "War never changes"; } return result; }
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/Fallout.java:17: warning: [FallThrough] Execution may fall through from the previous case; add a `// fall through` comment before this line if it was deliberate default: ^ (see http://errorprone.info/bugpattern/ FallThrough) 1 warning
public class TemplarBase { protected Assassin ezio; public Creed getCreed() { return ezio.getCreed(); } } public class TemplarCastle extends TemplarBase { protected Assassin ezio; }
public class TemplarBase { protected Assassin ezio; public Creed getCreed() { return ezio.getCreed(); } } public class TemplarCastle extends TemplarBase { protected Assassin ezio; }
~/code/experimentation/src/main/java/ae/droidcon/ errorprone/TemplarCastle.java:4: warning: [HidingField] Hiding fields of superclasses may cause confusion and errors. This field is hiding a field of the same name in superclass: TemplarBase protected Assassin ezio; ^ (see http://errorprone.info/bugpattern/ HidingField) 1 warning
Found 1 issue Persona.java:13: error: NULL_DEREFERENCE object `shadow` last assigned on line 12 could be null and is dereferenced at line 13. 11. void destroyShadow(String person) { 12. final Shadow shadow = getShadowForPerson(person); 13. > shadow.unshadow(); 14. } 15. }
> Task :app:countDebugDexMethods Total methods in app-debug.apk: 52673 (80.37% used) Total fields in app-debug.apk: 30053 (45.86% used) Total classes in app-debug.apk: 6962 (10.62% used) Methods remaining in app-debug.apk: 12862 Fields remaining in app-debug.apk: 35482 Classes remaining in app-debug.apk: 58573
> Task :app:countDebugDexMethods Total methods in app-debug.apk: 69802 (106.51% used) Total fields in app-debug.apk: 42438 (64.76% used) Total classes in app-debug.apk: 9291 (14.18% used) Methods remaining in app-debug.apk: 0 Fields remaining in app-debug.apk: 23097 Classes remaining in app-debug.apk: 56244