Skip to content

[java] Support JDK 15#2714

Merged
oowekyala merged 14 commits into
pmd:masterfrom
adangel:jdk15
Aug 22, 2020
Merged

[java] Support JDK 15#2714
oowekyala merged 14 commits into
pmd:masterfrom
adangel:jdk15

Conversation

@adangel

@adangel adangel commented Aug 13, 2020

Copy link
Copy Markdown
Member

Describe the PR

Update PMD Java to support Java 15.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Complete build ./mvnw clean verify passes (checked automatically by travis)
  • Added (in-code) documentation (if needed)

@adangel adangel added this to the 6.27.0 milestone Aug 13, 2020
@ghost

ghost commented Aug 13, 2020

Copy link
Copy Markdown
1 Message
📖 This changeset introduces 143 new violations, 16 new errors and 0 new configuration errors,
removes 143 violations, 16 errors and 0 configuration errors.
Full report
This changeset introduces 143 new violations, 16 new errors and 0 new configuration errors,
removes 143 violations, 16 errors and 0 configuration errors.
Full report
This changeset introduces 0 new violations, 16 new errors and 0 new configuration errors,
removes 0 violations, 16 errors and 0 configuration errors.
Full report
This changeset introduces 0 new violations, 13 new errors and 0 new configuration errors,
removes 0 violations, 13 errors and 0 configuration errors.
Full report

Generated by 🚫 Danger

@adangel adangel marked this pull request as ready for review August 14, 2020 21:26
@adangel adangel requested a review from oowekyala August 14, 2020 21:26

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for working on this!

It's buried in the JEP, but local interfaces and enums are now allowed too.

Given the usefulness of local records, it would be useful to have local enums and local interfaces too. They were traditionally disallowed in Java because of concern over their semantics. Specifically, nested enums and nested interfaces are implicitly static, so local enums and local interfaces should be implicitly static too; yet, local declarations in the Java language (local variables, local classes) are never static. However, the introduction of local records in JEP 359 [the first record preview] overcame this semantic concern, allowing a local declaration to be static, and opening the door to local enums and local interfaces.

(source: https://openjdk.java.net/jeps/384)

Comment thread pmd-java/etc/grammar/Java.jjt Outdated
Comment thread pmd-java/etc/grammar/Java.jjt Outdated
Comment thread pmd-java/etc/grammar/Java.jjt Outdated
Comment thread pmd-java/etc/grammar/Java.jjt Outdated
Comment thread pmd-java/etc/grammar/Java.jjt Outdated
Comment thread pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java15PreviewTest.java Outdated
@oowekyala oowekyala added the in:ast About the AST structure or API, the parsing step label Aug 16, 2020
@adangel

adangel commented Aug 16, 2020

Copy link
Copy Markdown
Member Author

Thanks for working on this!

It's buried in the JEP, but local interfaces and enums are now allowed too.

Given the usefulness of local records, it would be useful to have local enums and local interfaces too. They were traditionally disallowed in Java because of concern over their semantics. Specifically, nested enums and nested interfaces are implicitly static, so local enums and local interfaces should be implicitly static too; yet, local declarations in the Java language (local variables, local classes) are never static. However, the introduction of local records in JEP 359 [the first record preview] overcame this semantic concern, allowing a local declaration to be static, and opening the door to local enums and local interfaces.

(source: https://openjdk.java.net/jeps/384)

I've seen this, but interpreted it just as this would theoretically be possible now (the door is open to allow this) but wasn't actually done yet.... But it seems, it's implemented in javac already - at least it compiles.

@oowekyala oowekyala left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. If you agree, I'd like to do the merge into java-grammar myself. Since you update ASM, I'd like to update #2689 at the same time

@adangel

adangel commented Aug 22, 2020

Copy link
Copy Markdown
Member Author

If you agree, I'd like to do the merge into java-grammar myself.

Yes, I would appreciate this. You're more familiar with the java-grammar branch 😄

@oowekyala oowekyala self-assigned this Aug 22, 2020
@oowekyala oowekyala merged commit 04850c6 into pmd:master Aug 22, 2020
oowekyala added a commit that referenced this pull request Aug 22, 2020
@adangel adangel deleted the jdk15 branch August 23, 2020 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in:ast About the AST structure or API, the parsing step

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[java] Support JDK 15

2 participants