Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems using OML libraries from a command line application. #15

Closed
NicolasRouquette opened this issue May 18, 2017 · 3 comments
Closed

Comments

@NicolasRouquette
Copy link
Member

The OML Converter loads *.oml files using an XtextResourceSet.
This has worked before...

But now, I get a java.lang.UnsupportedOperationException:

"main@1" prio=5 tid=0x1 nid=NA runnable
  java.lang.Thread.State: RUNNABLE
	  at org.eclipse.emf.ecore.impl.MinimalEStoreEObjectImpl.eBasicAdapterListeners(MinimalEStoreEObjectImpl.java:311)
	  at org.eclipse.emf.internal.cdo.CDOObjectImpl.eBasicAdapterListeners(CDOObjectImpl.java:1087)
	  at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.addListener(MinimalEObjectImpl.java:537)
	  at org.eclipse.emf.ecore.impl.MinimalEStoreEObjectImpl.eBasicSetAdapterArray(MinimalEStoreEObjectImpl.java:302)
	  at org.eclipse.emf.ecore.impl.MinimalEObjectImpl$1ArrayDelegatingAdapterList.setData(MinimalEObjectImpl.java:483)
	  at org.eclipse.emf.common.util.ArrayDelegatingEList.addUnique(ArrayDelegatingEList.java:388)
	  at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:303)
	  at org.eclipse.xtext.nodemodel.impl.NodeModelBuilder.associateWithSemanticElement(NodeModelBuilder.java:106)
	  at org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.associateNodeWithAstElement(AbstractInternalAntlrParser.java:267)
	  at org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.forceCreateModelElement(AbstractInternalAntlrParser.java:687)
	  at gov.nasa.jpl.imce.oml.dsl.parser.antlr.internal.InternalOMLParser.ruleExtent(InternalOMLParser.java:230)
	  at gov.nasa.jpl.imce.oml.dsl.parser.antlr.internal.InternalOMLParser.entryRuleExtent(InternalOMLParser.java:184)
	  at sun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethodAccessorImpl.java:-1)
	  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	  at java.lang.reflect.Method.invoke(Method.java:498)
	  at org.eclipse.xtext.parser.antlr.AbstractInternalAntlrParser.parse(AbstractInternalAntlrParser.java:557)
	  at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.doParse(AbstractAntlrParser.java:102)
	  at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.parse(AbstractAntlrParser.java:84)
	  at org.eclipse.xtext.parser.antlr.AbstractAntlrParser.doParse(AbstractAntlrParser.java:62)
	  at org.eclipse.xtext.parser.AbstractParser.parse(AbstractParser.java:33)
	  at org.eclipse.xtext.resource.XtextResource.doLoad(XtextResource.java:176)
	  at org.eclipse.xtext.linking.lazy.LazyLinkingResource.doLoad(LazyLinkingResource.java:100)
	  at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1518)
	  at org.eclipse.emf.ecore.resource.impl.ResourceImpl.load(ResourceImpl.java:1297)
	  at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoad(ResourceSetImpl.java:259)
	  at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:274)
	  at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:265)
	  at gov.nasa.jpl.imce.oml.converters.utils.OMLResourceSet$$anonfun$loadOMLResource$1.apply(OMLResourceSet.scala:72)
	  at gov.nasa.jpl.imce.oml.converters.utils.OMLResourceSet$$anonfun$loadOMLResource$1.apply(OMLResourceSet.scala:72)
	  at gov.nasa.jpl.imce.oml.converters.utils.EMFProblems$$anonfun$nonFatalCatch$2.apply(EMFProblems.scala:83)
	  at gov.nasa.jpl.imce.oml.converters.utils.EMFProblems$$anonfun$nonFatalCatch$2.apply(EMFProblems.scala:83)
	  at scala.util.control.Exception$Catch.apply(Exception.scala:103)
	  at gov.nasa.jpl.imce.oml.converters.utils.EMFProblems$.nonFatalCatch(EMFProblems.scala:83)
	  at gov.nasa.jpl.imce.oml.converters.utils.OMLResourceSet$.loadOMLResource(OMLResourceSet.scala:72)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverterFromTextualConcreteSyntax$$anonfun$1$$anonfun$apply$1.apply(OMLConverterFromTextualConcreteSyntax.scala:46)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverterFromTextualConcreteSyntax$$anonfun$1$$anonfun$apply$1.apply(OMLConverterFromTextualConcreteSyntax.scala:45)
	  at scalaz.$bslash$div.flatMap(Either.scala:135)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverterFromTextualConcreteSyntax$$anonfun$1.apply(OMLConverterFromTextualConcreteSyntax.scala:45)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverterFromTextualConcreteSyntax$$anonfun$1.apply(OMLConverterFromTextualConcreteSyntax.scala:43)
	  at scala.collection.LinearSeqOptimized$class.foldLeft(LinearSeqOptimized.scala:124)
	  at scala.collection.immutable.List.foldLeft(List.scala:84)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverterFromTextualConcreteSyntax$.convert(OMLConverterFromTextualConcreteSyntax.scala:43)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverter$.main(OMLConverter.scala:61)
	  at gov.nasa.jpl.imce.oml.converters.OMLConverter.main(OMLConverter.scala:-1)

It seems that the Xtext parser makes extensive use of EAnnotations; which in turn seems to require that the underlying ecore metamodel be implemented without the MinimalEObject implementation since it clearly does not support annotations.

NicolasRouquette added a commit that referenced this issue May 19, 2017
@NicolasRouquette
Copy link
Member Author

NicolasRouquette commented May 19, 2017

The oml platform feature is intended to be an aggregate to ensure consistent dependencies for OML-related development across diverse JVM-based ecosystems including Eclipse, Scala, etc...

This feature includes org.eclipse.emf.cdo feature, which as of version 4.5.0.v20160607-1254 includes the following plugin:

   <plugin
         id="org.eclipse.emf.cdo.ecore.retrofit"
         download-size="0"
         install-size="0"
         version="4.2.300.v20160301-1326"
         fragment="true"
         unpack="false"/>

This feature also includes the org.eclipse.emf.sdk feature, which as of version 2.12.0.v20160526-0356 transitively includes the following plugin:

   <plugin
         id="org.eclipse.emf"
         download-size="0"
         install-size="0"
         version="2.6.0.v20160526-0356"
         unpack="false"/>

Outside of Eclipse, adding all the plugin jars from the oml platform feature results in a conflict between the two above plugins since they both provide org.eclipse.emf-related classes.
When loading an Xtext-based resource, the classloader will load one or the other.

  • If it loads org.eclipse.emf.cdo.ecore.retrofit then parsing will fail with the above exception.
  • If it loads org.eclipse.emf, then parsing will not trigger the the above exception.

The reason is a subtle difference in MinimalEStoreEObjectImpl in these two libraries.

In org.eclipse.emf.cdo.ecore.retrofit, this class includes the following methods:

    protected Listener[] eBasicAdapterListeners() {
        throw new UnsupportedOperationException();
    }

    protected void eBasicSetAdapterListeners(Listener[] eAdapterListeners) {
        throw new UnsupportedOperationException();
    }

These methods are not defined in the org.eclipse.emf plugin version of MinimalEStoreEObjectImpl.

@NicolasRouquette
Copy link
Member Author

For the time being, the workaround is to delete the org.eclipse.emf.cdo.ecore.retrofit jar when extracting the oml platform feature for executing OML-based applications outside of Eclipse.

@NicolasRouquette
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant