Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Help me] broken cross-reference error(when the reference target is deleted, an exception will be thrown out)
icon5.gif  [Help me] broken cross-reference error [message #665902] Mon, 18 April 2011 05:17 Go to next message
Kevin Sun is currently offline Kevin SunFriend
Messages: 32
Registered: August 2010
Location: China
Member

I use a simple grammar like this,

Model:
(elements += Element ';')*
;
Element :
Def
| Use
;
Def :
'def' name = ID
;
Use :
'use' def = [Def]
;


and the case is following,

def var;
use var;


It works well.
But when the "def var" is deleted, an exception will be thrown out (the version of xtext i use is: 1.0.0.v201006170321 )

java.lang.ClassCastException: org.xtext.example.mydsl12.myDsl.impl.UseImpl cannot be cast to org.xtext.example.mydsl12.myDsl.Def
at org.xtext.example.mydsl12.myDsl.impl.UseImpl.getDef(UseImpl. java:75)
at org.xtext.example.mydsl12.myDsl.impl.UseImpl.eGet(UseImpl.ja va:119)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1021)
at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec tImpl.java:1013)
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImp l.hasNext(EContentsEList.java:409)
at org.eclipse.xtext.EcoreUtil2.resolveCrossReferences(EcoreUti l2.java:485)
at org.eclipse.xtext.EcoreUtil2.resolveAll(EcoreUtil2.java:469)
at org.eclipse.xtext.validation.ResourceValidatorImpl.resolvePr oxies(ResourceValidatorImpl.java:122)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate( ResourceValidatorImpl.java:60)
at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec( ValidationJob.java:76)
at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec( ValidationJob.java:1)
at org.eclipse.xtext.util.concurrent.IStateAccess$AbstractImpl. readOnly(IStateAccess.java:40)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(Xte xtDocument.java:58)
at org.eclipse.xtext.ui.editor.validation.ValidationJob.createI ssues(ValidationJob.java:74)
at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(Val idationJob.java:63)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Re: [Help me] broken cross-reference error [message #665909 is a reply to message #665902] Mon, 18 April 2011 06:13 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Kevin,

please update to Xtext 1.0.2 - this one was fixed some months ago.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 18.04.11 07:17, schrieb Kevin Sun:
> I use a simple grammar like this,
>
> Model:
> (elements += Element ';')*
> ;
> Element :
> Def | Use ;
> Def :
> 'def' name = ID ;
> Use :
> 'use' def = [Def]
> ;
>
>
> and the case is following,
>
> def var;
> use var;
>
>
> It works well.
> But when the "def var" is deleted, an exception will be thrown out (the
> version of xtext i use is: 1.0.0.v201006170321 )
>
> java.lang.ClassCastException:
> org.xtext.example.mydsl12.myDsl.impl.UseImpl cannot be cast to
> org.xtext.example.mydsl12.myDsl.Def
> at org.xtext.example.mydsl12.myDsl.impl.UseImpl.getDef(UseImpl. java:75)
> at org.xtext.example.mydsl12.myDsl.impl.UseImpl.eGet(UseImpl.ja va:119)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec
> tImpl.java:1021)
> at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eGet(BasicEObjec
> tImpl.java:1013)
> at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImp
> l.hasNext(EContentsEList.java:409)
> at org.eclipse.xtext.EcoreUtil2.resolveCrossReferences(EcoreUti
> l2.java:485)
> at org.eclipse.xtext.EcoreUtil2.resolveAll(EcoreUtil2.java:469)
> at org.eclipse.xtext.validation.ResourceValidatorImpl.resolvePr
> oxies(ResourceValidatorImpl.java:122)
> at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(
> ResourceValidatorImpl.java:60)
> at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(
> ValidationJob.java:76)
> at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(
> ValidationJob.java:1)
> at org.eclipse.xtext.util.concurrent.IStateAccess$AbstractImpl.
> readOnly(IStateAccess.java:40)
> at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(Xte
> xtDocument.java:58)
> at org.eclipse.xtext.ui.editor.validation.ValidationJob.createI
> ssues(ValidationJob.java:74)
> at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(Val
> idationJob.java:63)
> at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Re: [Help me] broken cross-reference error [message #665912 is a reply to message #665909] Mon, 18 April 2011 06:52 Go to previous message
Kevin Sun is currently offline Kevin SunFriend
Messages: 32
Registered: August 2010
Location: China
Member

thanks. I update the xtext, and there is no problem like this. Smile
Previous Topic:Completion proposal truncated strings
Next Topic:Use of unordered group produces unhelpful error messages
Goto Forum:
  


Current Time: Sat Apr 27 00:19:10 GMT 2024

Powered by FUDForum. Page generated in 0.03820 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top