Trivadis / plsql-formatter-settings

PL/SQL & SQL formatter settings based on the Trivadis PL/SQL & SQL Coding Guidelines
Apache License 2.0
134 stars 46 forks source link

tvdformat.jar doesn't work with Java 22 #279

Open zjullion opened 2 months ago

zjullion commented 2 months ago
Exception in thread "main" java.lang.NoSuchMethodError: 'void sun.misc.Unsafe.ensureClassInitialized(java.lang.Class)'
        at com.oracle.truffle.api.library.LibraryFactory.ensureLibraryInitialized(LibraryFactory.java:385)
        at com.oracle.truffle.api.library.LibraryFactory.getUncached(LibraryFactory.java:365)
        at com.oracle.truffle.api.library.LibraryFactory.<init>(LibraryFactory.java:211)
        at com.oracle.truffle.api.interop.InteropLibraryGen.<init>(InteropLibraryGen.java:178)
        at com.oracle.truffle.api.interop.InteropLibraryGen.<clinit>(InteropLibraryGen.java:169)
        at java.base/java.lang.Class.forName0(Native Method)
        at java.base/java.lang.Class.forName(Class.java:529)
        at java.base/java.lang.Class.forName(Class.java:508)
        at com.oracle.truffle.api.library.LibraryFactory.loadGeneratedClass(LibraryFactory.java:799)
        at com.oracle.truffle.api.library.LibraryFactory.resolveImpl(LibraryFactory.java:748)
        at com.oracle.truffle.api.library.LibraryFactory.resolve(LibraryFactory.java:741)
        at com.oracle.truffle.api.interop.InteropLibrary.<clinit>(InteropLibrary.java:2941)
        at com.oracle.truffle.polyglot.PolyglotValueDispatch.<clinit>(PolyglotValueDispatch.java:167)
        at com.oracle.truffle.polyglot.PolyglotImpl.initialize(PolyglotImpl.java:199)
        at org.graalvm.polyglot.Engine.loadAndValidateProviders(Engine.java:1686)
        at org.graalvm.polyglot.Engine$1.run(Engine.java:1712)
        at org.graalvm.polyglot.Engine$1.run(Engine.java:1707)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:319)
        at org.graalvm.polyglot.Engine.initEngineImpl(Engine.java:1707)
        at org.graalvm.polyglot.Engine$ImplHolder.<clinit>(Engine.java:190)
        at org.graalvm.polyglot.Engine.getImpl(Engine.java:442)
        at org.graalvm.polyglot.HostAccess$Builder.targetTypeMapping(HostAccess.java:1282)
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.createNashornHostAccess(GraalJSScriptEngine.java:107)
        at com.oracle.truffle.js.scriptengine.GraalJSScriptEngine.<clinit>(GraalJSScriptEngine.java:102)
        at com.trivadis.plsql.formatter.TvdFormat.<init>(TvdFormat.java:20)
        at com.trivadis.plsql.formatter.TvdFormat.main(TvdFormat.java:48)
PhilippSalvisberg commented 2 months ago

Thanks @zjullion for reporting this issue. Yes, I can reproduce this behaviour with JDK 22. It works with JDK 21.

The included GraalVM JavaScript engine is not compatible with JDK 22. See https://github.com/Trivadis/plsql-formatter-settings/blob/sqldev-23.1.0/standalone/pom.xml#L16 and https://github.com/oracle/graaljs/issues/825 .