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

1.9.0 release jar issue #1014

Closed
chenrui333 opened this issue Dec 19, 2023 · 5 comments
Closed

1.9.0 release jar issue #1014

chenrui333 opened this issue Dec 19, 2023 · 5 comments
Assignees

Comments

@chenrui333
Copy link
Contributor

There is some issue with the google-java-format-1.19.0-all-deps.jar jar.

$ java --version
openjdk 21 2023-09-19 LTS
OpenJDK Runtime Environment Corretto-21.0.0.35.1 (build 21+35-LTS)
OpenJDK 64-Bit Server VM Corretto-21.0.0.35.1 (build 21+35-LTS, mixed mode, sharing)

$ cat foo.java
public class Foo{
}

$ java -jar /Users/rui/Downloads/google-java-format-1.19.0-all-deps.jar  foo.java
error: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
java.lang.LinkageError: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
	at com.google.googlejavaformat.java.Formatter.createVisitor(Formatter.java:182)
	at com.google.googlejavaformat.java.Formatter.format(Formatter.java:156)
	at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:283)
	at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:257)
	at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:75)
	at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:29)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ClassNotFoundException: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:421)
	at java.base/java.lang.Class.forName(Class.java:412)
	at com.google.googlejavaformat.java.Formatter.createVisitor(Formatter.java:177)
	... 11 more
@EvaristeGalois11
Copy link
Contributor

I think this is the same problem of #1015

If somebody needs a temporary workaround for this, recompiling locally with jdk 21 works for me.

@chenrui333
Copy link
Contributor Author

If somebody needs a temporary workaround for this, recompiling locally with jdk 21 works for me.

that is a good pointer, I will try out jdk17 for now then. Thanks!

@cushon
Copy link
Collaborator

cushon commented Dec 19, 2023

Thanks @EvaristeGalois11 for the PR, I will get a new point release out today after that's merged.

@cushon
Copy link
Collaborator

cushon commented Dec 19, 2023

I pushed a 1.19.1 release that fixes the crash on JDK 21: https://github.com/google/google-java-format/releases/tag/v1.19.1

$ java --version
openjdk 21.0.1 2023-10-17 LTS

$ java -jar google-java-format-1.19.0-all-deps.jar foo.java
error: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
java.lang.LinkageError: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
	at com.google.googlejavaformat.java.Formatter.createVisitor(Formatter.java:182)
	at com.google.googlejavaformat.java.Formatter.format(Formatter.java:156)
	at com.google.googlejavaformat.java.Formatter.getFormatReplacements(Formatter.java:283)
	at com.google.googlejavaformat.java.Formatter.formatSource(Formatter.java:257)
	at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:75)
	at com.google.googlejavaformat.java.FormatFileCallable.call(FormatFileCallable.java:29)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.lang.ClassNotFoundException: com.google.googlejavaformat.java.java21.Java21InputAstVisitor
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:526)
	at java.base/java.lang.Class.forName0(Native Method)
	at java.base/java.lang.Class.forName(Class.java:421)
	at java.base/java.lang.Class.forName(Class.java:412)
	at com.google.googlejavaformat.java.Formatter.createVisitor(Formatter.java:177)
	... 11 more
	
$  java -jar google-java-format-1.19.1-all-deps.jar foo.java
public class Foo {}

@cushon cushon closed this as completed Dec 19, 2023
@chenrui333
Copy link
Contributor Author

@cushon thanks for the quick turnaround! 🙏

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

No branches or pull requests

3 participants