Skip to content
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

Change target Java version to 7 #2043

Merged
merged 3 commits into from
Dec 31, 2021

Conversation

Marcono1234
Copy link
Collaborator

@Marcono1234 Marcono1234 commented Dec 30, 2021

Resolves #2018

Also tries to add some documentation to the README regarding Java version and JPMS module requirements. I am not sure if the formatting and wording is ideal; feedback is appreciated.

Follow-up task:
Remove the Java version overwrite (and comment) in https://github.com/google/oss-fuzz/blob/master/projects/gson/build.sh
Done, see google/oss-fuzz#7086

@@ -1,4 +1,4 @@
# gson-codegen
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was an oversight by me; all other modules are using the folder name (instead of the artifact ID).

Comment on lines -7 to +8
sourceCompatibility = 1.6
targetCompatibility = 1.6
sourceCompatibility = 1.7
targetCompatibility = 1.7
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably does not matter because the Gradle build is outdated anyway, see #1896.

@@ -161,7 +161,7 @@ public void testJavaSerialization() throws IOException, ClassNotFoundException {
}

@SafeVarargs
private <T> void assertIterationOrder(Iterable<T> actual, T... expected) {
private final <T> void assertIterationOrder(Iterable<T> actual, T... expected) {
Copy link
Collaborator Author

@Marcono1234 Marcono1234 Dec 30, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly when changing the version to Java 7 this caused a build failure (due to private methods not supporting @SafeVarargs in Java 7), but when the version was Java 6 this compiled fine. Most likely because @SafeVarargs was added in Java 7, but (unlike --release) the -source and -target compiler flags do not prevent using newer API.

@eamonnmcmanus eamonnmcmanus merged commit dc28951 into google:master Dec 31, 2021
@eamonnmcmanus
Copy link
Member

Thanks! Alea jacta est.

@Marcono1234 Marcono1234 deleted the marcono1234/java-7 branch January 1, 2022 17:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drop support for Java 6
2 participants