ankitflow001 commented on PR #24122:
URL: https://github.com/apache/kafka/pull/24122#issuecomment-6831142708

   Thank you! The classes were identified with a small throwaway script plus 
   compiler verification:
   
   1. A Python script walks clients/src/main/java and indexes every type's 
      declared method names. For each class it collects the supertype set 
      (extends/implements), then flags public/ protected non-static, 
      non-abstract methods whose names match a supertype method  or 
      toString/equals/hashCode without a preceding @Override.
   
   2. The heuristic produces false positives (name collisions without real 
      override relationships  static factories, helper methods that happen 
      to share a name, nested classes), so I applied @Override to all ~150 
      candidates and let javac decide: every misplaced annotation fails 
      with method does not override or implement a method from a 
      supertype. After removing those, 90 verified annotations remained.
   
   This is also why -Xlint:all -Werror didn't catch them javac's 
   overrides lint only covers superclass method overrides, not interface 
   implementations or Object method overrides.
   
   Agreed that integrating ErrorProne would be valuable  the 
   MissingOverride bug pattern covers interface implementations and would 
   prevent regressions systematically rather than relying on one-off scripts. 
   Happy to post the scan script here or as a gist if useful for other 
   modules, and glad to help with the ErrorProne integration under 
   KIP-1369 if there's appetite for it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to