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

Adds a Google Java Format for JDK17 #2572

Merged
merged 1 commit into from Feb 18, 2022

Conversation

bric3
Copy link
Contributor

@bric3 bric3 commented Feb 18, 2022

Currently Google Java Format rely on javac internal classes

diffplug/spotless#834
https://github.com/diffplug/spotless/tree/main/plugin-gradle#google-java-format

Running ./gradlew spotlessJava with JDK 17 produces this error

> Task :spotlessJava FAILED
Step 'google-java-format' found problem in 'src/main/java/org/mockito/invocation/DescribedInvocation.java':
class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x1b6d12d8) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x1b6d12d8
java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x1b6d12d8) cannot access class com.sun.tools.javac.parser.Tokens$TokenKind (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.parser to unnamed module @0x1b6d12d8
        at com.google.googlejavaformat.java.JavaInput.buildToks(JavaInput.java:349)
        at com.google.googlejavaformat.java.JavaInput.buildToks(JavaInput.java:334)
        at com.google.googlejavaformat.java.JavaInput.<init>(JavaInput.java:276)

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should mention Fixes #<issue number> if relevant

@bric3 bric3 force-pushed the spotless-format-jdk17-mitigation branch from 494e6c0 to 260bf20 Compare February 18, 2022 16:54
@bric3 bric3 force-pushed the spotless-format-jdk17-mitigation branch from 260bf20 to 384f792 Compare February 18, 2022 16:58
Copy link
Contributor

@TimvdLippe TimvdLippe left a comment

Choose a reason for hiding this comment

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

Thanks for the fix Brice! Feel free to merge when CI is fully green.

@codecov-commenter
Copy link

codecov-commenter commented Feb 18, 2022

Codecov Report

Merging #2572 (384f792) into main (50d7e71) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##               main    #2572   +/-   ##
=========================================
  Coverage     86.65%   86.65%           
  Complexity     2795     2795           
=========================================
  Files           321      321           
  Lines          8368     8368           
  Branches       1024     1024           
=========================================
  Hits           7251     7251           
  Misses          849      849           
  Partials        268      268           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 50d7e71...384f792. Read the comment docs.

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.

None yet

3 participants