kbendick commented on pull request #1493: URL: https://github.com/apache/iceberg/pull/1493#issuecomment-699718969
> Does it fix the warning to use a lambda and cast to `Consumer` instead? This could be something like: > > ```java > Consumer<String> defaultDelete = (Consumer<String>) file -> io.delete(file); > ``` @rdblue I will be honest and say that I ran `clean build` from master in intelliJ after invalidating all caches and restarting and the only somewhat similar warning I could find was `[UnnecessaryLambda]` (which doesn't sound like what you're describing. I will double check that I don't get a warning like that when running from the CLI (as possibly IntelliJ is hiding this from me). I do however like your idea. I tried it, though I did get warnings about a possibly uninitialized variable for `ops` as I had to use `ops.io.delete(file)`. So I'm not sure that's better. Though now that I've found this same code in several classes, I'm thinking it might make sense to refactor it out for reusability? Here's the only Lambda related warning I could find: ``` [UnnecessaryLambda] Returning a lambda from a helper method or saving it in a constant is unnecessary; prefer to implement the functional interface method directly and use a method reference instead. (see https://errorprone.info/bugpattern/UnnecessaryLambda) Did you mean 'private DatumReader<?> defaultCreateReaderFunc(Schema readSchema){'? ``` ---------------------------------------------------------------- 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]
