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

ties to Java 9+ API in Spotless even though Java 8 is the minimum required #1081

Closed
smoothreggae opened this issue Jan 10, 2022 · 1 comment
Labels

Comments

@smoothreggae
Copy link

Summary of the problem

While adding Spotless to the build for one of the repositories I work with, I stumbled upon a problem which suggests that the bytecode has ties to API available only in Java 9+. The trigger was a properties file in the repository that had ISO-8859-1 characters in it instead of Unicode escape sequences. Since Spotless uses UTF-8 by default, I would have expected Spotless to report an encoding error (e.g. Encoding error! Spotless uses UTF-8 by default. At line 14 col 176:). Instead, what I get is java.nio.ByteBuffer.clear()Ljava/nio/ByteBuffer;. I am using Java SE 8. If I switch the build to Java 11, I get the expected error message.

Also, Spotless does not tell me the name of the guilty file. Adding --debug helps me figure that out. I see that #868 is already open for this.

https://jira.mongodb.org/browse/JAVA-2559 appears to be related and has a good explanation of the cause and a possible solution.

Gradle version

7.3.3

Spotless version

5.7.0 appears to be the earliest version where this problem occurs.

Operating system and version

Windows 10/RHEL 7.3

public repository to demonstrate the problem

https://github.com/smoothreggae/spotless-ties-to-java9

@nedtwigg
Copy link
Member

Thanks for reporting. Fixed in plugin-gradle 6.5.0 and plugin-maven 2.22.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants