tg
tg copied to clipboard
Experimental use of Error Prone
Description
The Error Prone compiler plugin needs to be experimented with in order to identify its usefulness for developing the TG platform. This issue is concerned only with the initial familiarisation and experimentation with this tool, which could also result in code changes to address its recommendations.
Compilation errors/recommendations by Error Prone should be categorised and outlined in this issue as a task list.
- [ ] 1. [DoubleBraceInitialization] Prefer collection factory methods or builders to the double-brace initialization pattern.
- [ ] 2. BadAnnotationImplementation Classes that implement Annotation must override
equalsandhashCode. Use of@AutoAnnotationis recommended. Here is a good discussion about it.@AutoAnnotationis from https://github.com/google/auto. - [ ] 3. [FormatString] unknown format conversion:
]. - [ ] 4. [ComputeIfAbsentAmbiguousReference]
computeIfAbsentpasses the map key to the provided class's constructor. - [ ] 5. [EqualsHashCode] Classes that override
equalsshould also overridehashCode. - [ ] 6. [FormatString] illegal format conversion:
java.lang.Objectcannot be formatted using%f. - [ ] 7. [GetClassOnClass] Calling
getClass()on an object of type Class returns the Class object for java.lang.Class. - [ ] 8. [GetClassOnAnnotation] Calling
getClass()on an annotation may return a proxy class. - [ ] 9. [OptionalMapUnusedValue]
Optional.ifPresentis preferred overOptional.mapwhen the return value is unused. - [ ] 10. [ReturnValueIgnored] Return value of
reducemust be used. - [ ] ...
Expected outcome
Better understanding of the Error Prone capabilities, code improvements and a plan for further adoption of this tool.