Bytecoder icon indicating copy to clipboard operation
Bytecoder copied to clipboard

java.lang.IllegalStateException: Cannot find virtual method compareAndSetInt in non-abstract class jdk/internal/misc/Unsafe with signature BOOLEAN(java.lang.Object,LONG,INT,INT

Open rctrj opened this issue 2 years ago • 2 comments

Hi, I was trying to port one of my projects to web and am getting this error

Exception in thread "main" java.lang.reflect.InvocationTargetException
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:564)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: java.lang.IllegalStateException: Cannot find virtual method compareAndSetInt in non-abstract class jdk/internal/misc/Unsafe with signature BOOLEAN(java.lang.Object,LONG,INT,INT)
        at de.mirkosertic.bytecoder.core.BytecodeInstructionINVOKEVIRTUAL.performLinking(BytecodeInstructionINVOKEVIRTUAL.java:57)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveMethodSignatureAndBody(BytecodeLinkedClass.java:482)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveVirtualMethod(BytecodeLinkedClass.java:370)
        at de.mirkosertic.bytecoder.core.BytecodeInstructionINVOKEVIRTUAL.performLinking(BytecodeInstructionINVOKEVIRTUAL.java:55)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveMethodSignatureAndBody(BytecodeLinkedClass.java:482)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveVirtualMethod(BytecodeLinkedClass.java:370)
        at de.mirkosertic.bytecoder.core.BytecodeInstructionINVOKEVIRTUAL.performLinking(BytecodeInstructionINVOKEVIRTUAL.java:55)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveMethodSignatureAndBody(BytecodeLinkedClass.java:482)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveVirtualMethod(BytecodeLinkedClass.java:370)
        at de.mirkosertic.bytecoder.core.BytecodeLinkedClass.resolveInheritedOverriddenMethods(BytecodeLinkedClass.java:539)
        at de.mirkosertic.bytecoder.core.BytecodeLinkerContext.resolveAbstractMethodsInSubclasses(BytecodeLinkerContext.java:147)
        at de.mirkosertic.bytecoder.core.BytecodeLinkerContext.resolveAbstractMethodsInSubclasses(BytecodeLinkerContext.java:151)
        at de.mirkosertic.bytecoder.core.BytecodeLinkerContext.resolveAbstractMethodsInSubclasses(BytecodeLinkerContext.java:151)
        at de.mirkosertic.bytecoder.backend.CompileTarget.compile(CompileTarget.java:324)
        at de.mirkosertic.bytecoder.cli.BytecoderCLI.main(BytecoderCLI.java:132)
        ... 8 more

I am not able to pin-point the source at the moment since the code-base is pretty big. This is the build script I'm using

cd build/libs || exit

unzip shadowJar.jar

cd -

java -jar ../libs/bytecoder-cli-2021-07-23-executable.jar -classpath=build/libs/ -mainclass=web.Main -builddirectory=./prod -backend=js -minify=false -debug=true

Same script is able to compile a dummy libgdx game (1 texture + 1 image)

rctrj avatar Aug 16 '21 06:08 rctrj

Thank you for using Bytecoder! Do you have a full compile log, and not only the stacktrace? I need this to further track down this issue?

mirkosertic avatar Aug 24 '21 11:08 mirkosertic

@mirkosertic see #694 for a very similar looking trace about another java internal. sample project included.

hcldan avatar Mar 25 '22 15:03 hcldan

Closed due to no further feedback.

mirkosertic avatar Mar 29 '23 16:03 mirkosertic