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

Make the build JDK 18+ compatible #304

Merged
merged 2 commits into from
Oct 23, 2022
Merged

Conversation

rickie
Copy link
Member

@rickie rickie commented Oct 18, 2022

@werli reported that he got some errors when running Error Prone Support with JDK 18.0.2.
After some investigation I found these two JDK bug reports:

The first one flagged quite some violations. To resolve these violations, the default non-arg constructors are added with Javadoc. This solution is not ideal. However by looking at the docs of the javadoc command, and more specifically the options, I don't see a way to configure the check to go around this...

For me, this check flags a lot of missing Javadocs during development. Therefore, it'd be a good idea to not disable this check and use this PR to make the code compatible with JDK 18.

$ java -version
openjdk version "18.0.2" 2022-07-19
IBM Semeru Runtime Open Edition 18.0.2.0 (build 18.0.2+9)

@rickie rickie requested review from Stephan202 and werli October 18, 2022 13:14
@werli
Copy link
Member

werli commented Oct 18, 2022

I'll get back to this PR later on. I had checked out the branch however and the advertised mvn clean install now works using OpenJDK 18. 🎉

$ java --version
openjdk 18.0.2 2022-07-19
OpenJDK Runtime Environment (build 18.0.2+0)
OpenJDK 64-Bit Server VM (build 18.0.2+0, mixed mode)

Copy link
Member

@werli werli left a comment

Choose a reason for hiding this comment

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

Indeed a workaround, but fine for me. 👍

@Stephan202 Stephan202 added this to the 0.5.0 milestone Oct 22, 2022
@Stephan202 Stephan202 force-pushed the rossendrijver/jdk-18-compatible branch from 5676b49 to 810fe58 Compare October 22, 2022 14:14
Copy link
Member

@Stephan202 Stephan202 left a comment

Choose a reason for hiding this comment

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

It's a bit boiler-plate-y, but I agree it's nicer to keep the lint check enabled.

Suggested commit message:

Make the build JDK 18+ compatible (#304)

Comment on lines 64 to 65
// For more details, see https://bugs.openjdk.org/browse/JDK-8274336.
@SuppressWarnings("serial")
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// For more details, see https://bugs.openjdk.org/browse/JDK-8274336.
@SuppressWarnings("serial")
@SuppressWarnings("serial" /* Concrete instance will be `Serializable`. */)

@@ -36,6 +36,9 @@ public final class AmbiguousJsonCreator extends BugChecker implements Annotation
private static final Matcher<AnnotationTree> IS_JSON_CREATOR_ANNOTATION =
isType("com.fasterxml.jackson.annotation.JsonCreator");

/** Instantiates the default {@link AmbiguousJsonCreator}. */
Copy link
Member

Choose a reason for hiding this comment

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

"The default" hints at there being a non-default instance, while in fact there can be zero or more equivalent instances. How about:

Suggested change
/** Instantiates the default {@link AmbiguousJsonCreator}. */
/** Instantiates a new {@link AmbiguousJsonCreator} instance. */

(The three existing cases should be named "a default", as a contrast with "a customized".)

Copy link
Member Author

Choose a reason for hiding this comment

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

Aha, I see. I used the same sentence that we already used in a few places 😬.

@Stephan202 Stephan202 force-pushed the rossendrijver/jdk-18-compatible branch from 810fe58 to e69f82d Compare October 22, 2022 14:15
@rickie rickie marked this pull request as ready for review October 23, 2022 15:35
@rickie
Copy link
Member Author

rickie commented Oct 23, 2022

Should've marked it ready a bit sooner. Will merge once last part is 🟢 .

@rickie rickie force-pushed the rossendrijver/jdk-18-compatible branch from e69f82d to 5ecf901 Compare October 23, 2022 15:38
@rickie rickie changed the title Make code compatible with JDK 18 Make the build JDK 18+ compatible Oct 23, 2022
@rickie rickie merged commit e00aba1 into master Oct 23, 2022
@rickie rickie deleted the rossendrijver/jdk-18-compatible branch October 23, 2022 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

3 participants