Skip to content

Spotless apply throws an error when running with JDK_17 #1210

Open
@abubkr-hago

Description

@abubkr-hago

New Issue Checklist

Issue Description

Spotless is formatting a lot of files not related to changes when applied before a commit.

Steps to reproduce

./gradlew spotlessApply

Expected Outcome

Applying code formatting rules to all project files successfully.

Actual Outcome

Step 'google-java-format' found problem in 'parse\src\main\java\com\parse\AbstractQueryController.java':
null
java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.GeneratedMethodAccessor519.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at com.diffplug.spotless.java.GoogleJavaFormatStep$State.lambda$createFormat$1(GoogleJavaFormatStep.java:176)
	at com.diffplug.spotless.FormatterFunc.apply(FormatterFunc.java:32)
	at com.diffplug.spotless.FormatterStepImpl$Standard.format(FormatterStepImpl.java:78)
	at com.diffplug.spotless.FormatterStep$Strict.format(FormatterStep.java:76)
	at com.diffplug.spotless.Formatter.compute(Formatter.java:230)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:201)
	at com.diffplug.spotless.PaddedCell.calculateDirtyState(PaddedCell.java:188)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl.processInputFile(SpotlessTaskImpl.java:71)
	at com.diffplug.gradle.spotless.SpotlessTaskImpl.performAction(SpotlessTaskImpl.java:57)
	at jdk.internal.reflect.GeneratedMethodAccessor468.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)

...

Caused by: java.lang.IllegalAccessError: class com.google.googlejavaformat.java.JavaInput (in unnamed module @0x654fd887) 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 @0x654fd887
	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)
	at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:280)
	at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:267)
	at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:233)
	... 136 more

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:ciCI related issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions