| Summary: | CCE accessing overridden grammar with new serializer | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Ed Willink <ed> | ||||||
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | critical | ||||||||
| Priority: | P3 | CC: | moritz.eysholdt, sebastian.zarnekow | ||||||
| Version: | 2.0.1 | Flags: | sebastian.zarnekow:
juno+
|
||||||
| Target Milestone: | RC1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows Vista | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Most likely related to bug 347171 hi Ed, the problem that most likely caused this issue has been fixed. Could you verify if the problem still exists for you with the latest version of Xtext (i.e. the nightly build)? thx After regenerating, looks good. [Difficult to get the N-build past P2; had to uninstall Xtext first.] Created attachment 215906 [details] Editor start up failure (In reply to comment #3) > After regenerating, looks good. No. CRITICAL. It's really bad, although the fix enables me to re-activate some JUnit tests and they all pass when running standalone, when running as plugin tests I now get 68 failures mostly of the form shown below. Attempting to open editors interactively is also disastrous; same error (attached). internalFindGrammar is new code, so I suspect some magic class-loader/injection must be occuring. Created attachment 215907 [details]
JUnit plugin failure trace
Examples from attachments for Bugzilla search hits Caused by: org.eclipse.emf.common.util.WrappedException: org.eclipse.xtext.resource.ClasspathUriResolutionException: java.lang.IllegalStateException: Couldn't find resource on classpath. URI was 'classpath:/org/eclipse/ocl/examples/xtext/oclinecore/OCLinEcore.xmi' at org.eclipse.xtext.parser.BaseEPackageAccess.loadResource(BaseEPackageAccess.java:57) at org.eclipse.xtext.parser.BaseEPackageAccess.loadGrammarFile(BaseEPackageAccess.java:44) at org.eclipse.xtext.service.GrammarProvider.getGrammar(GrammarProvider.java:57) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.internalFindGrammar(EssentialOCLGrammarAccess.java:2539) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.<init>(EssentialOCLGrammarAccess.java:2535) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:501) at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:85) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85) ---- Caused by: org.eclipse.xtext.resource.ClasspathUriResolutionException: java.lang.IllegalStateException: Couldn't find resource on classpath. URI was 'classpath:/org/eclipse/ocl/examples/xtext/oclinecore/OCLinEcore.xmi' at org.eclipse.xtext.resource.ClassloaderClasspathUriResolver.resolve(ClassloaderClasspathUriResolver.java:48) at org.eclipse.xtext.resource.XtextResourceSet.resolveClasspathURI(XtextResourceSet.java:36) at org.eclipse.xtext.resource.XtextResourceSet.access$0(XtextResourceSet.java:35) at org.eclipse.xtext.resource.XtextResourceSet$1.normalize(XtextResourceSet.java:105) ---- Caused by: org.eclipse.emf.common.util.WrappedException: org.eclipse.xtext.resource.ClasspathUriResolutionException: java.lang.IllegalStateException: Couldn't find resource on classpath. URI was 'classpath:/org/eclipse/ocl/examples/xtext/oclinecore/OCLinEcore.xmi' at org.eclipse.xtext.parser.BaseEPackageAccess.loadResource(BaseEPackageAccess.java:57) at org.eclipse.xtext.parser.BaseEPackageAccess.loadGrammarFile(BaseEPackageAccess.java:44) at org.eclipse.xtext.service.GrammarProvider.getGrammar(GrammarProvider.java:57) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.internalFindGrammar(EssentialOCLGrammarAccess.java:2539) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.<init>(EssentialOCLGrammarAccess.java:2535) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:501) at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:85) If I revert the generated editor, but continue to use the N-build the new problem goes away, so the bug is in the generated code. Your runtime modules are missing a binding of the right classloader. see also bug 379903 The latest nightly will add that binding after regenerating the language. Thanks. N201205191342 works for me. Requested via bug 522520. -M. Requested via bug 522520. -M. |
With the new serializer I'm getting java.lang.ClassCastException: org.eclipse.xtext.impl.AlternativesImpl cannot be cast to org.eclipse.xtext.RuleCall at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess$NavigatingArgExpCSElements.<init>(EssentialOCLGrammarAccess.java:1981) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.getNavigatingArgExpCSAccess(EssentialOCLGrammarAccess.java:2921) at org.eclipse.ocl.examples.xtext.essentialocl.services.EssentialOCLGrammarAccess.getNavigatingArgExpCSRule(EssentialOCLGrammarAccess.java:2925) at org.eclipse.ocl.examples.xtext.essentialocl.serializer.AbstractEssentialOCLSemanticSequencer.createSequence(AbstractEssentialOCLSemanticSequencer.java:257) at org.eclipse.ocl.examples.xtext.completeocl.serializer.AbstractCompleteOCLSemanticSequencer.sequence_NavigatingExpCS(AbstractCompleteOCLSemanticSequencer.java:1020) at org.eclipse.ocl.examples.xtext.completeocl.serializer.AbstractCompleteOCLSemanticSequencer.createSequence(AbstractCompleteOCLSemanticSequencer.java:411) at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptEObjectRuleCall(SequenceFeeder.java:299) at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.acceptRuleCall(SequenceFeeder.java:325) at org.eclipse.xtext.serializer.acceptor.SequenceFeeder.accept(SequenceFeeder.java:239) The relevant bad cast occurs in code that has not changed wityh the recent N-build: public class NavigatingArgExpCSElements extends AbstractParserRuleElementFinder { private final ParserRule rule = (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "NavigatingArgExpCS"); private final RuleCall cExpCSParserRuleCall = (RuleCall)rule.eContents().get(1); The rule has two contained features: type and alternatives, so get(1) returns an AlternativesImpl that gives the CCE. This code was not executed when using the old serializer, since the old serializer did not use the EssentialOCLGrammarAccess for the CompleteOCL grammar. The rule in the base EssentialOCL grammar is: NavigatingArgExpCS returns ExpCS: // Intended to be overridden ExpCS // '?' -- defined by Complete OCL ; The overridden rule in the CompleteOCL grammar is: NavigatingArgExpCS returns essentialocl::ExpCS: ({OclMessageArgCS} '?') | ExpCS ; The problem seems to be in the use of superSequencer in the generated AbstractCompleteOCLSemanticSequencer: /** * Constraint: * ( * ( * namedExp=NavigatingExpCS_NavigatingExpCS_1_0 * ( * argument+=NavigatingArgCS * argument+=NavigatingCommaArgCS* * (argument+=NavigatingSemiArgCS argument+=NavigatingCommaArgCS*)? * (argument+=NavigatingBarArgCS argument+=NavigatingCommaArgCS*)? * )? * ) | * namedExp=NavigatingExpCS_NavigatingExpCS_1_0 * ) * * Features: * namedExp[0, 2] * argument[0, *] * EXCLUDE_IF_UNSET namedExp * EXCLUDE_IF_SET namedExp */ protected void sequence_NavigatingExpCS(EObject context, NavigatingExpCS semanticObject) { superSequencer.createSequence(context, semanticObject); }