-
Notifications
You must be signed in to change notification settings - Fork 3
Replace anonymous classes with lambdas #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
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.