Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext validation internal error while migrating to XTEXT2
xtext validation internal error while migrating to XTEXT2 [message #726337] Sat, 17 September 2011 13:01 Go to next message
iokerica is currently offline iokericaFriend
Messages: 14
Registered: September 2011
Junior Member
Hi all,

I meet a validation error when migrating to XTEXT2.

It complains about ClassCastException, it seems that it is trying to cast String to
QualifiedName. I want to insert an image but I cannot use that function yet.

This bug will happen when I use the two elements together.
which one class and subclass extends it. and one IfEffectivePackageBlock.
Any Suggestions?

The grammer is

IfEffectivePackageBlock:
'ifEffective' effectivityId=ID '{'
(elements+=AbstractElement)*
'}'
;

ClassDeclaration:
'class' name=ID ('extends' superType=[ClassDeclaration])? '{'
(statements+=(
FunctionDef |
ConfigurationEntryPoint

)
)*
'}'
;

Tell me if you need more info.
Re: xtext validation internal error while migrating to XTEXT2 [message #726338 is a reply to message #726337] Sat, 17 September 2011 13:12 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

can you share a stacktrace. please note: the interface of the iqualifiednameprovider has changed: its return type is now QualifiedName.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: xtext validation internal error while migrating to XTEXT2 [message #726412 is a reply to message #726338] Sun, 18 September 2011 00:13 Go to previous messageGo to next message
iokerica is currently offline iokericaFriend
Messages: 14
Registered: September 2011
Junior Member
At first, it's just log4j shows the warning.

!ENTRY org.apache.log4j 4 0 2011-09-18 08:07:58.109
!MESSAGE org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy - java.lang.String cannot be cast to org.eclipse.xtext.naming.QualifiedName


!ENTRY org.apache.log4j 4 0 2011-09-18 08:08:01.390
!MESSAGE org.eclipse.xtext.resource.impl.DefaultResourceDescriptionStrategy - java.lang.String cannot be cast to org.eclipse.xtext.naming.QualifiedName


!ENTRY org.apache.log4j 4 0 2011-09-18 08:08:01.417
!MESSAGE org.eclipse.xtext.linking.lazy.LazyLinkingResource - resolution of uriFragment 'xtextLink_::0.0.1.2::1::/7' failed.

Then after I types three elements then error popup shows

!ENTRY org.eclipse.core.jobs 4 2 2011-09-18 08:08:09.903
!MESSAGE An internal error occurred during: "Xtext validation".
!STACK 0
org.eclipse.emf.common.util.WrappedException: java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.xtext.naming.QualifiedName
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:201)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReference(LazyLinkingResource.java:139)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.resolveLazyCrossReferences(LazyLinkingResource.java:103)
at org.eclipse.xtext.EcoreUtil2.resolveLazyCrossReferences(EcoreUtil2.java:417)
at org.eclipse.xtext.validation.ResourceValidatorImpl.resolveProxies(ResourceValidatorImpl.java:127)
at org.eclipse.xtext.validation.ResourceValidatorImpl.validate(ResourceValidatorImpl.java:62)
at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:79)
at org.eclipse.xtext.ui.editor.validation.ValidationJob$1.exec(ValidationJob.java:1)
at org.eclipse.xtext.util.concurrent.AbstractReadWriteAcces.readOnly(AbstractReadWriteAcces.java:32)
at org.eclipse.xtext.ui.editor.model.XtextDocument.readOnly(XtextDocument.java:86)
at org.eclipse.xtext.ui.editor.validation.ValidationJob.createIssues(ValidationJob.java:75)
at org.eclipse.xtext.ui.editor.validation.ValidationJob.run(ValidationJob.java:64)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:54)
Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to org.eclipse.xtext.naming.QualifiedName
at org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider$2.get(DefaultDeclarativeQualifiedNameProvider.java:62)
at org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider$2.get(DefaultDeclarativeQualifiedNameProvider.java:1)
at org.eclipse.xtext.util.OnChangeEvictingCache.get(OnChangeEvictingCache.java:46)
at org.eclipse.xtext.naming.DefaultDeclarativeQualifiedNameProvider.getFullyQualifiedName(DefaultDeclarativeQualifiedNameProvider.java:58)
at org.eclipse.xtext.naming.IQualifiedNameProvider$AbstractImpl.apply(IQualifiedNameProvider.java:31)
at org.eclipse.xtext.naming.IQualifiedNameProvider$AbstractImpl.apply(IQualifiedNameProvider.java:1)
at org.eclipse.xtext.scoping.Scopes$2.apply(Scopes.java:90)
at org.eclipse.xtext.scoping.Scopes$2.apply(Scopes.java:1)
at com.google.common.collect.Iterators$8.next(Iterators.java:697)
at com.google.common.collect.Iterators$7.computeNext(Iterators.java:602)
at com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:135)
at com.google.common.collect.AbstractIterator.hasNext(AbstractIterator.java:130)
at org.eclipse.xtext.scoping.impl.MultimapBasedSelectable.setExportedObjects(MultimapBasedSelectable.java:97)
at org.eclipse.xtext.scoping.impl.MultimapBasedSelectable.<init>(MultimapBasedSelectable.java:36)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.internalGetAllDescriptions(ImportedNamespaceAwareLocalScopeProvider.java:216)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider$2.get(ImportedNamespaceAwareLocalScopeProvider.java:204)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider$2.get(ImportedNamespaceAwareLocalScopeProvider.java:1)
at org.eclipse.xtext.util.OnChangeEvictingCache.get(OnChangeEvictingCache.java:46)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getAllDescriptions(ImportedNamespaceAwareLocalScopeProvider.java:202)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:112)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:101)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:89)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:87)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:87)
at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:102)
at org.eclipse.xtext.linking.impl.DefaultLinkingService.getScope(DefaultLinkingService.java:59)
at org.eclipse.xtext.linking.impl.DefaultLinkingService.getLinkedObjects(DefaultLinkingService.java:119)
at org.eclipse.xtext.linking.lazy.LazyLinkingResource.getEObject(LazyLinkingResource.java:170)
... 12 more

[Updated on: Sun, 18 September 2011 00:20]

Report message to a moderator

Re: xtext validation internal error while migrating to XTEXT2 [message #726414 is a reply to message #726412] Sun, 18 September 2011 00:23 Go to previous message
iokerica is currently offline iokericaFriend
Messages: 14
Registered: September 2011
Junior Member
I guess I know what's wrong.
I have defined a subclass extends DefaultDeclarativeQualifiedNameProvider
But I just return String in the qualifiedName method.
Since it compiles, I didn't notice it.

But it seems you didn't update the comment.

in comment, it is still written as String. Smile

* computes the fully qualified name of an EObject by first invoking a method <br/>
* <code>String qualifiedName(MyType ele)</code><br/>
* reflectively.

Thanks for hints.
Clark

[Updated on: Sun, 18 September 2011 00:42]

Report message to a moderator

Previous Topic:[Serializer 2.0] State 'stop' may not follow 'start'
Next Topic:[serializer 2.0]how to fix it?
Goto Forum:
  


Current Time: Sat Apr 20 02:22:07 GMT 2024

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

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

Back to the top