tg icon indicating copy to clipboard operation
tg copied to clipboard

Experimental use of Error Prone

Open 01es opened this issue 2 years ago • 0 comments

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 equals and hashCode. Use of @AutoAnnotation is recommended. Here is a good discussion about it. @AutoAnnotation is from https://github.com/google/auto.
  • [ ] 3. [FormatString] unknown format conversion: ].
  • [ ] 4. [ComputeIfAbsentAmbiguousReference] computeIfAbsent passes the map key to the provided class's constructor.
  • [ ] 5. [EqualsHashCode] Classes that override equals should also override hashCode.
  • [ ] 6. [FormatString] illegal format conversion: java.lang.Object cannot 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.ifPresent is preferred over Optional.map when the return value is unused.
  • [ ] 10. [ReturnValueIgnored] Return value of reduce must be used.
  • [ ] ...

Expected outcome

Better understanding of the Error Prone capabilities, code improvements and a plan for further adoption of this tool.

01es avatar Jun 21 '23 02:06 01es