Xtext and Java 16 [message #1841507] |
Wed, 19 May 2021 13:05 |
|
Hi
has anyone tried to build an Xtext language with Java 16?
I made a very quick experiment with Maven/Tycho and the build fails when executing MWE2 itself with the following trace. I bet it's due to the more restrictive module access and maybe to Guice trying to do that (see the end of the trace)?
[INFO] --- exec-maven-plugin:3.0.0:java (mwe2Launcher) @ io.github.lorenzobettini.tychoxbasetestlanguage ---
0 [org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main()] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
com.google.inject.internal.util.$ComputationException: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:49)
at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:125)
at com.google.inject.internal.InjectorImpl.initializeBinding(InjectorImpl.java:507)
at com.google.inject.internal.AbstractBindingProcessor$Processor$1.run(AbstractBindingProcessor.java:159)
at com.google.inject.internal.ProcessedBindingData.initializeBindings(ProcessedBindingData.java:44)
at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:122)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)
at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjector(Mwe2StandaloneSetupGenerated.java:47)
at org.eclipse.emf.mwe2.language.Mwe2StandaloneSetupGenerated.createInjectorAndDoEMFRegistration(Mwe2StandaloneSetupGenerated.java:41)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:76)
at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:37)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:254)
at java.base/java.lang.Thread.run(Thread.java:831)
Caused by: com.google.inject.internal.util.$ComputationException: java.lang.ExceptionInInitializerError
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:553)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:419)
at com.google.inject.internal.util.$CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
at com.google.inject.internal.FailableCache.get(FailableCache.java:50)
at com.google.inject.internal.MembersInjectorStore.get(MembersInjectorStore.java:65)
at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:73)
at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:28)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:36)
at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:32)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
... 19 more
Caused by: java.lang.ExceptionInInitializerError
at com.google.inject.internal.cglib.reflect.$FastClassEmitter.<init>(FastClassEmitter.java:67)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.generateClass(FastClass.java:72)
at com.google.inject.internal.cglib.core.$DefaultGeneratorStrategy.generate(DefaultGeneratorStrategy.java:25)
at com.google.inject.internal.cglib.core.$AbstractClassGenerator.create(AbstractClassGenerator.java:216)
at com.google.inject.internal.cglib.reflect.$FastClass$Generator.create(FastClass.java:64)
at com.google.inject.internal.BytecodeGen.newFastClass(BytecodeGen.java:207)
at com.google.inject.internal.SingleMethodInjector.createMethodInvoker(SingleMethodInjector.java:49)
at com.google.inject.internal.SingleMethodInjector.<init>(SingleMethodInjector.java:38)
at com.google.inject.internal.MembersInjectorStore.getInjectors(MembersInjectorStore.java:125)
at com.google.inject.internal.MembersInjectorStore.createWithListeners(MembersInjectorStore.java:95)
at com.google.inject.internal.MembersInjectorStore.access$000(MembersInjectorStore.java:34)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:42)
at com.google.inject.internal.MembersInjectorStore$1.create(MembersInjectorStore.java:39)
at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:39)
at com.google.inject.internal.util.$MapMaker$StrategyImpl.compute(MapMaker.java:549)
... 29 more
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make protected final java.lang.Class java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain) throws java.lang.ClassFormatError accessible: module java.base does not "opens java.lang" to unnamed module @42554467
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:357)
at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297)
at java.base/java.lang.reflect.Method.checkCanSetAccessible(Method.java:199)
at java.base/java.lang.reflect.Method.setAccessible(Method.java:193)
at com.google.inject.internal.cglib.core.$ReflectUtils$2.run(ReflectUtils.java:56)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:312)
at com.google.inject.internal.cglib.core.$ReflectUtils.<clinit>(ReflectUtils.java:46)
... 44 more
HOME: http://www.lorenzobettini.it
TDD Book: https://leanpub.com/tdd-buildautomation-ci
Xtext Book: https://www.packtpub.com/application-development/implementing-domain-specific-languages-xtext-and-xtend-second-edition
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Xtext and Java 16 [message #1843169 is a reply to message #1843061] |
Sat, 17 July 2021 21:43 |
Michael Bischoff Messages: 19 Registered: August 2012 |
Junior Member |
|
|
I did a couple of tests.
1) The Java 17 EA (build 31) works with option "--add-opens java.base/java.lang=ALL-UNNAMED" (which more or less negates jigsaw)
2) With the test instructions by Lorenzo, I was able to almost build my DSLs using the Christian's xtext guice snapshot (build date July 13th) , without any of the above compiler options.
It worked with Java 11 and Java 16. Java 17 failed due to Tycho (I used 2.3, support for Java 17 will be added in 2.4, but due to https://github.com/eclipse/tycho/issues/179 it looks like that one will not be usable with Xtext, which is a blocker)
The "almost" refers to some dependency issue in the final step, building the update site (very likely due to some mistake on my side which I did not yet spot), and some warnings about version mismatches in the build logs:
WARNING: Skipping conflicting project org.eclipse.emf.common at 'archive:file:/home/mbi/.m2/repository/org/eclipse/emf/org.eclipse.emf.common/2.22.0/org.eclipse.emf.common-2.22.0.jar!/' and using 'archive:file:/home/mbi/.m2/repository/p2/osgi/bundle/org.eclipse.emf.common/2.19.0.v20200324-0932/org.eclipse.emf.common-2.19.0.v20200324-0932.jar!/' instead.
Jul 17, 2021 10:28:51 PM org.eclipse.emf.mwe.utils.StandaloneSetup registerMapping
WARNING: Skipping conflicting project org.eclipse.equinox.app at 'archive:file:/home/mbi/.m2/repository/org/eclipse/platform/org.eclipse.equinox.app/1.5.100/org.eclipse.equinox.app-1.5.100.jar!/' and using 'archive:file:/home/mbi/.m2/repository/p2/osgi/bundle/org.eclipse.equinox.app/1.4.500.v20200422-1833/org.eclipse.equinox.app-1.4.500.v20200422-1833.jar!/' instead.
WARNING: Skipping conflicting project org.eclipse.core.contenttype at 'archive:file:/home/mbi/.m2/repository/org/eclipse/platform/org.eclipse.core.contenttype/3.7.900/org.eclipse.core.contenttype-3.7.900.jar!/' and using 'archive:file:/home/mbi/.m2/repository/p2/osgi/bundle/org.eclipse.core.contenttype/3.7.700.v20200517-1644/org.eclipse.core.contenttype-3.7.700.v20200517-1644.jar!/' instead.
I could not yet test using the generated plugins, due to the issues with the update site, I will follow up those next week. The current branch is here: https://github.com/jpaw/bonaparte-dsl/tree/guice5test
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04680 seconds