RussellSpitzer edited a comment on pull request #1493:
URL: https://github.com/apache/iceberg/pull/1493#issuecomment-698063386


   I believe the warning is mostly just upset that you save a abstract function 
class as a field rather than a well defined object with a named method or use 
just a named function. I believe they would rather it was 
   
   ```java
   Deleter defaultDelete = new Deleter()
   
   class Deleter {
     void doDelete(String) {
     }
   }
   ```
   Where you extend Deleter rather than passing in a lambda. I think this is 
unnecessary and we should just suppress.
   
   
   The docs give this example
   https://errorprone.info/bugpattern/UnnecessaryAnonymousClass
   Yes
   ```java
   private static Bar getBar(Foo foo) {
     return BarService.lookupBar(foo, defaultCredentials());
   }
   .
   
   return someStream().map(MyClass::getBar)....;
   ```
   
   No
   ```java
   private static final Function<Foo, Bar> GET_BAR_FUNCTION =
       new Function<Foo, Bar>() {
         @Override
         public Bar apply(Foo foo) {
           return BarService.lookupBar(foo, defaultCredentials());
         }
       };
   
   return someStream().map(GET_BAR_FUNCTION)....;
   ```
   
   So it's not so much the Lambda, but rather the fact that a function is a 
field. I think the fact that our field is mutable
   makes this kinda moot.
   


----------------------------------------------------------------
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.

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



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to