-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Java 8 follow-up changes #2747
Merged
eamonnmcmanus
merged 4 commits into
google:main
from
Marcono1234:marcono1234/java-8-follow-up
Sep 24, 2024
Merged
Java 8 follow-up changes #2747
eamonnmcmanus
merged 4 commits into
google:main
from
Marcono1234:marcono1234/java-8-follow-up
Sep 24, 2024
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Note that for the `final` variable warnings, it seems some of those variables were made `final` intentionally, without the compiler requiring it. But for consistency I removed the `final` from them as well.
Is disabled by default as well. It seems what this pattern does is suggest to replace anonymous classes stored in constants with a corresponding method (with the intention that the developer then uses a method reference to that method). But it even does this when the anonymous class implements a custom functional type, and not a generic type such as `Function`. For example it suggested to replace ``` private static final FieldNamingStrategy CUSTOM_FIELD_NAMING_STRATEGY = new FieldNamingStrategy() { @OverRide public String translateName(Field f) { return "foo"; } }; ``` with a method ``` private static String customFieldNamingStrategy(Field f) { return "foo"; } ``` Which is probably not that helpful, and might not actually increase readability.
Marcono1234
added
the
java8
Issues related to making Java 8 the minimum supported version
label
Sep 23, 2024
Marcono1234
commented
Sep 23, 2024
gson/src/main/java/com/google/gson/internal/NonNullElementWrapperList.java
Outdated
Show resolved
Hide resolved
Marcono1234
force-pushed
the
marcono1234/java-8-follow-up
branch
from
September 23, 2024 23:59
dd92ea3
to
9cad067
Compare
eamonnmcmanus
approved these changes
Sep 24, 2024
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great, thanks! Look at all those final
modifiers deleted.
- java: 21 | ||
# Disable Enforcer check which (intentionally) prevents using JDK 21 for building | ||
extra-mvn-args: -Denforcer.fail=false | ||
java: [ 11, 17, 21 ] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Purpose
Follow-up for #2744
Resolves #2501 (building with JDK 21 is now possible without any custom configuration)
Description
Regarding the Error Prone warnings:
For the
final
variable warnings, it seems some of those variables were madefinal
intentionally, without the compiler requiring it. But for consistency I removed thefinal
from them as well.Checklist
This is automatically checked by
mvn verify
, but can also be checked on its own usingmvn spotless:check
.Style violations can be fixed using
mvn spotless:apply
; this can be done in a separate commit to verify that it did not cause undesired changes.null
@since $next-version$
(
$next-version$
is a special placeholder which is automatically replaced during release)TestCase
)mvn clean verify javadoc:jar
passes without errors