These are the sections I organized this hopefully not too verbose Issue into:
Template
Configuration
Error messages 1
Error messages 2
Error messages 3
Explanation
Workaround
Probably non solutions
Proposed solutions
Template
Describe GraalVM and your environment :
GraalVM version or commit id if built from source: 22.0.0.2
CE or EE: CE
JDK version: JDK17
OS and OS Version: Kubuntu 20.04
Architecture: amd64
The output of java -Xinternalversion:
OpenJDK 64-Bit Server VM (17.0.2+8-jvmci-22.0-b05) for linux-amd64 JRE (17.0.2+8-jvmci-22.0-b05), built on Jan 20 2022 22:54:40 by "buildslave" with gcc 10.3.0
Have you verified this issue still happens when using the latest snapshot?
No
At compilation error messages occur such like those:
1
de/dhbw/rahmlab/geomalgelang/truffle/nodes/binaryOps/Addition.java:[15,17] Uncaught error in AnnotationProcessor while processing de.dhbw.rahmlab.geomalgelang.truffle.nodes.binaryOps.Addition : Could not initialize class com.oracle.truffle.dsl.processor.expression.ExpressionLexer
java.lang.NoClassDefFoundError: Could not initialize class com.oracle.truffle.dsl.processor.expression.ExpressionLexer
at com.oracle.truffle.dsl.processor.expression.DSLExpression.parse(DSLExpression.java:181)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeLimit(NodeParser.java:2264)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeExpressions(NodeParser.java:2201)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeSpecializations(NodeParser.java:1884)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseNode(NodeParser.java:363)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseRootType(NodeParser.java:245)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parse(NodeParser.java:198)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parse(NodeParser.java:150)
at com.oracle.truffle.dsl.processor.parser.AbstractParser.parse(AbstractParser.java:115)
at com.oracle.truffle.dsl.processor.parser.AbstractParser.parse(AbstractParser.java:135)
at com.oracle.truffle.dsl.processor.AnnotationProcessor.processImpl(AnnotationProcessor.java:122)
at com.oracle.truffle.dsl.processor.AnnotationProcessor.process(AnnotationProcessor.java:109)
at com.oracle.truffle.dsl.processor.TruffleProcessor.processElement(TruffleProcessor.java:158)
at com.oracle.truffle.dsl.processor.TruffleProcessor.process(TruffleProcessor.java:122)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1023)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:939)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1267)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1382)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1234)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:916)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:136)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Suppressed: java.lang.RuntimeException: Parsing of Node de.dhbw.rahmlab.geomalgelang.truffle.nodes.binaryOps.Addition failed.
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseRootType(NodeParser.java:249)
... 46 more
2
de/dhbw/rahmlab/geomalgelang/truffle/nodes/binaryOps/RightContraction.java:[15,17] Uncaught error in AnnotationProcessor while processing de.dhbw.rahmlab.geomalgelang.truffle.nodes.binaryOps.RightContraction : null
java.lang.ExceptionInInitializerError
at com.oracle.truffle.dsl.processor.expression.DSLExpression.parse(DSLExpression.java:181)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeLimit(NodeParser.java:2264)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeExpressions(NodeParser.java:2201)
at com.oracle.truffle.dsl.processor.parser.NodeParser.initializeSpecializations(NodeParser.java:1884)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseNode(NodeParser.java:363)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseRootType(NodeParser.java:245)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parse(NodeParser.java:198)
at com.oracle.truffle.dsl.processor.parser.NodeParser.parse(NodeParser.java:150)
at com.oracle.truffle.dsl.processor.parser.AbstractParser.parse(AbstractParser.java:115)
at com.oracle.truffle.dsl.processor.parser.AbstractParser.parse(AbstractParser.java:135)
at com.oracle.truffle.dsl.processor.AnnotationProcessor.processImpl(AnnotationProcessor.java:122)
at com.oracle.truffle.dsl.processor.AnnotationProcessor.process(AnnotationProcessor.java:109)
at com.oracle.truffle.dsl.processor.TruffleProcessor.processElement(TruffleProcessor.java:158)
at com.oracle.truffle.dsl.processor.TruffleProcessor.process(TruffleProcessor.java:122)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:1023)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:939)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1267)
at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1382)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1234)
at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:916)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:136)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:182)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1209)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:198)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Suppressed: java.lang.RuntimeException: Parsing of Node de.dhbw.rahmlab.geomalgelang.truffle.nodes.binaryOps.RightContraction failed.
at com.oracle.truffle.dsl.processor.parser.NodeParser.parseRootType(NodeParser.java:249)
... 46 more
Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:56)
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:48)
at com.oracle.truffle.dsl.processor.expression.ExpressionLexer.<clinit>(ExpressionLexer.java:191)
... 52 more
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 3 (expected 4).
... 55 more
3
ANTLR Tool version 4.9.2 used for code generation does not match the current runtime version 4.11.1
ANTLR Runtime version 4.9.2 used for parser compilation does not match the current runtime version 4.11.1
Error messages 2
If I change the sequence of the dependencies so that truffle-dsl-processor is declared before antlr4-runtime, there are runtime errors instead:
1
ANTLR Tool version 4.11.1 used for code generation does not match the current runtime version 4.9.2
2
java.lang.ExceptionInInitializerError
at de.dhbw.rahmlab.geomalgelang.parsing.ParsingService.ensureLexerParserAvailable(ParsingService.java:51)
at de.dhbw.rahmlab.geomalgelang.parsing.ParsingService.ensureExprTransformAvailable(ParsingService.java:69)
at de.dhbw.rahmlab.geomalgelang.parsing.ParsingService.ensureAstStringAvailable(ParsingService.java:88)
at de.dhbw.rahmlab.geomalgelang.parsing.ParsingService.getAstString(ParsingService.java:105)
at de.dhbw.rahmlab.geomalgelang.parsing.ParsingService.getAstString(ParsingService.java:112)
at de.dhbw.rahmlab.geomalgelang.GrammarMixedTest.test(GrammarMixedTest.java:45)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:727)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:131)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:156)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:147)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:86)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(InterceptingExecutableInvoker.java:103)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.lambda$invoke$0(InterceptingExecutableInvoker.java:93)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:106)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:64)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:45)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:37)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:92)
at org.junit.jupiter.engine.execution.InterceptingExecutableInvoker.invoke(InterceptingExecutableInvoker.java:86)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:217)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:213)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:138)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:151)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:41)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$6(NodeTestTask.java:155)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:141)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:137)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$9(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:138)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:95)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:35)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:54)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:147)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:127)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:90)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.lambda$execute$0(EngineExecutionOrchestrator.java:55)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.withInterceptedStreams(EngineExecutionOrchestrator.java:102)
at org.junit.platform.launcher.core.EngineExecutionOrchestrator.execute(EngineExecutionOrchestrator.java:54)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:114)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:86)
at org.junit.platform.launcher.core.DefaultLauncherSession$DelegatingLauncher.execute(DefaultLauncherSession.java:86)
at org.apache.maven.surefire.junitplatform.LazyLauncher.execute(LazyLauncher.java:55)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.execute(JUnitPlatformProvider.java:223)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:175)
at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:139)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:456)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:169)
at org.apache.maven.surefire.booter.ForkedBooter.run(ForkedBooter.java:595)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:581)
Caused by: java.lang.UnsupportedOperationException: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
at org.antlr.v4.runtime.atn.ATNDeserializer.deserialize(ATNDeserializer.java:187)
at de.dhbw.rahmlab.geomalgelang.parsing.GeomAlgeLexer.<clinit>(GeomAlgeLexer.java:283)
... 77 more
Caused by: java.io.InvalidClassException: org.antlr.v4.runtime.atn.ATN; Could not deserialize ATN with version 4 (expected 3).
... 79 more
Error messages 3
If I omit the antlr4-runtime dependency declaration, a different runtime error occurs:
Exception in thread "main" java.lang.NoClassDefFoundError: org/antlr/v4/runtime/CharStream
at de.dhbw.rahmlab.geomalgelang.test.App.parseTestExtended(App.java:56)
at de.dhbw.rahmlab.geomalgelang.test.App.main(App.java:19)
Caused by: java.lang.ClassNotFoundException: org.antlr.v4.runtime.CharStream
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:520)
... 2 more
Explanation
truffle-dsl-processor-22.0.0.2.jar (22.2.0 as well) received from maven central contains the package org.antlr.v4.runtime. This conflicts with the same package from the antlr4-runtime dependency.
https://github.com/antlr/antlr4/releases/tag/4.10 says
“Generated 4.10 lexers and parsers are incompatible with code generated by previous versions of ANTLR. You must regenerate all of your code from grammars to use the new runtime.”
Conjecture for the case “Error Messages 1”
Antlr runtime files from both dependencies antlr4-runtime and truffle-dsl-processor are used.
Files with identical name and package from antlr4-runtime conceal those from truffle-dsl-processor.
The code from truffle-dsl-processor generated with another version of antlr is not compatible with the antlr runtime files from antlr4-runtime.
Conjecture for the case “Error Messages 2”
Antlr runtime files from both dependencies antlr4-runtime and truffle-dsl-processor are used.
Files with identical name and package from truffle-dsl-processor conceal those from antlr4-runtime.
The code from my project generated with another version of antlr is not compatible with the antlr runtime files from truffle-dsl-processor.
Conjecture for the case “Error Messages 3”
Antlr runtime files only from truffle-dsl-processor are used.
The code from my project generated with another version of antlr is not compatible with the antlr runtime files from truffle-dsl-processor.
Workaround
The following workaround works for me to get rid of the conflict.
The usually clean way to rely on mavens dependency machanism (declare a dependency to antlr4-runtime in the pom.xml of truffle-dsl-processor) will fail in this case since maven's dependency mediation just picks one version of the antlr4-runtime and thus preserves the conflict.
Updating the antlr4-runtime files deployed with truffle-dsl-processor does not resolve the cases when a project uses an older version of antlr or if antlr introduces another incompatible change in a future version.
Forcing the truffle users to employ only a specific set of compatible version of antlr could impede use cases not known in advance.
Proposed solutions
The most elegant solution I can think of is to provide a maven plugin for truffle-dsl-processor.
It seems to me this is also the most canonical way to handle compile-time only dependencies in maven.
Unfortunately I couldn't find that explicitly declared in some official Apache Maven documentation.
However I did find a post on Stackoverflow which provided a logical consistent recommendation in which case to use a plugin or a dependency with specific options:
https://stackoverflow.com/questions/12824112/is-there-a-maven-compiler-only-scope-for-dependency-artifacts/12824626#12824626
Another solution could be to change the package name of the antlr-runtime deployed with truffle-dsl-processor.
Overview
These are the sections I organized this hopefully not too verbose Issue into:
Template
Describe GraalVM and your environment :
java -Xinternalversion
:Have you verified this issue still happens when using the latest snapshot? No
Configuration
Excerpt from maven pom.xml of my project:
Error messages 1
At compilation error messages occur such like those:
1
2
3
Error messages 2
If I change the sequence of the dependencies so that truffle-dsl-processor is declared before antlr4-runtime, there are runtime errors instead:
1
2
Error messages 3
If I omit the antlr4-runtime dependency declaration, a different runtime error occurs:
Explanation
truffle-dsl-processor-22.0.0.2.jar (22.2.0 as well) received from maven central contains the package org.antlr.v4.runtime. This conflicts with the same package from the antlr4-runtime dependency.
https://github.com/antlr/antlr4/releases/tag/4.10 says “Generated 4.10 lexers and parsers are incompatible with code generated by previous versions of ANTLR. You must regenerate all of your code from grammars to use the new runtime.”
Conjecture for the case “Error Messages 1”
Antlr runtime files from both dependencies antlr4-runtime and truffle-dsl-processor are used. Files with identical name and package from antlr4-runtime conceal those from truffle-dsl-processor. The code from truffle-dsl-processor generated with another version of antlr is not compatible with the antlr runtime files from antlr4-runtime.
Conjecture for the case “Error Messages 2”
Antlr runtime files from both dependencies antlr4-runtime and truffle-dsl-processor are used. Files with identical name and package from truffle-dsl-processor conceal those from antlr4-runtime. The code from my project generated with another version of antlr is not compatible with the antlr runtime files from truffle-dsl-processor.
Conjecture for the case “Error Messages 3”
Antlr runtime files only from truffle-dsl-processor are used. The code from my project generated with another version of antlr is not compatible with the antlr runtime files from truffle-dsl-processor.
Workaround
The following workaround works for me to get rid of the conflict.
Remove from pom.xml
Add to pom.xml
Probably non solutions
The usually clean way to rely on mavens dependency machanism (declare a dependency to antlr4-runtime in the pom.xml of truffle-dsl-processor) will fail in this case since maven's dependency mediation just picks one version of the antlr4-runtime and thus preserves the conflict.
Updating the antlr4-runtime files deployed with truffle-dsl-processor does not resolve the cases when a project uses an older version of antlr or if antlr introduces another incompatible change in a future version.
Forcing the truffle users to employ only a specific set of compatible version of antlr could impede use cases not known in advance.
Proposed solutions
The most elegant solution I can think of is to provide a maven plugin for truffle-dsl-processor. It seems to me this is also the most canonical way to handle compile-time only dependencies in maven. Unfortunately I couldn't find that explicitly declared in some official Apache Maven documentation. However I did find a post on Stackoverflow which provided a logical consistent recommendation in which case to use a plugin or a dependency with specific options: https://stackoverflow.com/questions/12824112/is-there-a-maven-compiler-only-scope-for-dependency-artifacts/12824626#12824626
Another solution could be to change the package name of the antlr-runtime deployed with truffle-dsl-processor.