| Summary: | Package org.eclipse.xtext.util is exported twice | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Moritz Eysholdt <moritz.eysholdt> |
| Component: | Xtext Backlog | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | RESOLVED WONTFIX | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | loskutov |
| Version: | 2.0.0 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Moritz Eysholdt
I don't see how we can solve this without removing or changing public API. There is a possibility: right now this package is exported by those two bundles: org.eclipse.xtext 2.8.4.v201508050135 org.eclipse.xtext.util 2.8.4.v201508050135 but xtext bundle depends AND re-exports org.eclipse.xtext.util bundle. By reexporting the bundle all exported packages are also exported. So all what we need is to *move* org.eclipse.xtext.util.XtextAdapterFactory and org.eclipse.xtext.util.XtextSwitch classes from org.eclipse.xtext bundle to org.eclipse.xtext.util (and same for source code). Not sure if this is doable by changing the source paths because XtextSwitch seem to depend on other xtext classes, but at least at "deployment" level, after compiler has generated classes this should work. Since the package is the same and since the org.eclipse.xtext bundle re-exports the org.eclipse.xtext.util bundle classes, there will be no breakage for any client. The only clients who could notice the difference will be those who used org.eclipse.xtext.util bundle without using org.eclipse.xtext, and I doubt there were many and I also doubt they will be affected in any way. Beside the fact that exporting different contents under the same package name is a clear violation of any good practices, this causes issues in our environment because we have *patched* xtext bundle (but neither xtext.util bundle nor package) and the MWE build in the Eclipse can't build anything after the patch because the classloader denies to load classes from same package if the signing information of those classes differs: 247 [main] INFO clipse.emf.mwe.utils.GenModelHelper - Registered GenModel 'http://www.eclipse.org/xtext/common/JavaVMTypes' from 'platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel' 336 [main] ERROR mf.mwe2.launch.runtime.Mwe2Launcher - Problems instantiating module com.advantest.itee.GenerateFlowProgrammingLanguage: java.lang.SecurityException: class "org.eclipse.xtext.util.XtextSwitch"'s signer information does not match signer information of other classes in the same package java.lang.RuntimeException: Problems instantiating module com.advantest.itee.GenerateFlowProgrammingLanguage: java.lang.SecurityException: class "org.eclipse.xtext.util.XtextSwitch"'s signer information does not match signer information of other classes in the same package at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:95) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:62) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:52) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.run(Mwe2Launcher.java:78) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher.main(Mwe2Launcher.java:36) Caused by: org.eclipse.emf.common.util.WrappedException: java.lang.SecurityException: class "org.eclipse.xtext.util.XtextSwitch"'s signer information does not match signer information of other classes in the same package at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:157) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:104) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalApplyAssignments(Mwe2ExecutionEngine.java:142) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:114) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.inCase(Mwe2ExecutionEngine.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.eclipse.xtext.util.PolymorphicDispatcher.invoke(PolymorphicDispatcher.java:296) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.internalSwitch(Mwe2ExecutionEngine.java:66) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:62) at org.eclipse.emf.mwe2.launch.runtime.Mwe2Runner.run(Mwe2Runner.java:93) ... 4 more Caused by: java.lang.SecurityException: class "org.eclipse.xtext.util.XtextSwitch"'s signer information does not match signer information of other classes in the same package at java.lang.ClassLoader.checkCerts(ClassLoader.java:952) at java.lang.ClassLoader.preDefineClass(ClassLoader.java:666) at java.lang.ClassLoader.defineClass(ClassLoader.java:794) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) at java.net.URLClassLoader.defineClass(URLClassLoader.java:449) at java.net.URLClassLoader.access$100(URLClassLoader.java:71) at java.net.URLClassLoader$1.run(URLClassLoader.java:361) at java.net.URLClassLoader$1.run(URLClassLoader.java:355) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:354) at java.lang.ClassLoader.loadClass(ClassLoader.java:425) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308) at java.lang.ClassLoader.loadClass(ClassLoader.java:358) at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Class.java:2595) at java.lang.Class.getDeclaredConstructors(Class.java:1914) at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243) at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96) at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629) at com.google.inject.internal.UntargettedBindingProcessor$1.visit(UntargettedBindingProcessor.java:51) at com.google.inject.internal.UntargettedBindingProcessor$1.visit(UntargettedBindingProcessor.java:35) at com.google.inject.internal.UntargettedBindingImpl.acceptTargetVisitor(UntargettedBindingImpl.java:42) at com.google.inject.internal.UntargettedBindingProcessor.visit(UntargettedBindingProcessor.java:35) at com.google.inject.internal.UntargettedBindingProcessor.visit(UntargettedBindingProcessor.java:27) at com.google.inject.internal.BindingImpl.acceptVisitor(BindingImpl.java:93) at com.google.inject.internal.AbstractProcessor.process(AbstractProcessor.java:55) at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:178) at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103) 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.xtext.XtextStandaloneSetupGenerated.createInjector(XtextStandaloneSetupGenerated.java:29) at org.eclipse.xtext.XtextStandaloneSetupGenerated.createInjectorAndDoEMFRegistration(XtextStandaloneSetupGenerated.java:23) at org.eclipse.xtext.generator.Generator.<init>(Generator.java:125) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:383) at org.eclipse.emf.mwe2.language.factory.Mwe2ExecutionEngine.create(Mwe2ExecutionEngine.java:155) ... 28 more The classes can't be moved to org.eclipse.xtext.util since they rely on the EMF classes in org.eclipse.xtext, and they are not visible in the util bundle. |