Replace anonymous classes with lambdas#6
Replace anonymous classes with lambdas#6philwebb wants to merge 2 commits intospring-gradle-plugins:mainfrom
Conversation
Update the codebase to use lambdas or method references instead of anonymous classes whenever possible.
|
I think this may cause some up-to-date checks to break. Unfortunately, lambdas produce non-deterministic class names at runtime that are unstable from run to run. This prevents Gradle from identifying that the actions haven't changed. There's some more information in Gradle's documentation:
I'd be really nice to keep some of the other structural changes, though. |
|
Well that's annoying. Would the following change be enough to fix it? Is there a good way to add a test for the up-to-date checks? |
|
Sorry, @philwebb. Looking more closely, I think your original changes may be fine. The problem only applies to
Using |
|
Thanks for the PR @philwebb. I was under the same impression that lambdas did not work with up to date checking. In hindsight, I think this is only applicable when the lambda is an input or output to the task though. Perhaps you could switch this back to lambda's and add a test that verifies that rerunning in a new folder, the test is up to date. |
|
I'll revert the second commit and add a test |
Whilst looking at the code to asses options for #3 I noticed quite a few anonymous classes that could be replaced with lambdas. If Java 6 compatibility isn't an issue, perhaps these changes will be helpful.