Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Meaning of: feature was simple feature call but got receiver instead of null
Meaning of: feature was simple feature call but got receiver instead of null [message #1701841] Thu, 16 July 2015 07:22 Go to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 48
Registered: January 2013
Member
I implemented my own XbaseInterpreter. I forked the context in my subclass and added some new values. Lets say one of the values has type X.

When I call the evaluate method with my XBlockExpression and the forked context I get the exception

"feature was simple feature call but got receiver instead of null. Receiver: <here the instance of X>
"

What am I doing wrong?

What does the exception message mean?
Re: Meaning of: feature was simple feature call but got receiver instead of null [message #1701883 is a reply to message #1701841] Thu, 16 July 2015 12:28 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Udo,

it indicates that you have a link to a local variable or formal
parameter but your feature has also a linked receiver. That is
inconsistent. You may want to debug
XbaseInterpreter.invokeFeature(JvmIdentifiableElement,
XAbstractFeatureCall, Object, IEvaluationContext, CancelIndicator)

Best,
Sebastian--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Re: Meaning of: feature was simple feature call but got receiver instead of null [message #1701990 is a reply to message #1701883] Fri, 17 July 2015 09:46 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 48
Registered: January 2013
Member
Hi Sebastian,

I understand the first part of your answer. In my case the Xbase interpreter tries to assign an object to a variable where the interpreter thinks the left side of the equation is void which leads to the given message "feature was simple feature..."

But I do not understand how this can happen in my case.

I have an XBlockExpression with this content:

{
val x = 1
return x == 1
}

The error occurs for the variable declaration when the interpreter tries to assign the integer to the left side.
What am I missing?
Do I have to initialize the evaluation context?

The strange thing is that if I start the interpreter by initializing it with the standalone setup within Eclipse (which is not recommended) I do not get the above mention exception at all ( I do get class cast exceptions because of including the standalone setup but the expression is interpreted correctly).

What is the difference between the standalone setup and the "normal" Eclipse runimte for interpreting expressions?

With regards,
Udo
Re: Meaning of: feature was simple feature call but got receiver instead of null [message #1712055 is a reply to message #1701990] Wed, 21 October 2015 06:39 Go to previous messageGo to next message
Udo Walker is currently offline Udo WalkerFriend
Messages: 81
Registered: July 2009
Member
While debugging I found out that every time a XMemberFeatureCall was tried to interpret the problem occurs.

What is the exact meaning of XMemberFeatureCall? What piece of Xbase source creates a XMemberFeatureCall?

It occurs when I want to call eContainer of my sub class of EObject in the Xbase source.

It seems that the classpath is not correct i.e. the Xbase interpreter cannot find my references types and the more general types from EMF.

[Updated on: Wed, 21 October 2015 06:44]

Report message to a moderator

Re: Meaning of: feature was simple feature call but got receiver instead of null [message #1712123 is a reply to message #1712055] Wed, 21 October 2015 12:10 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Udo,

XMemberFeatureCalls are produced by the parser whenever it consumes a
chained feature call, e.g. a.b or a?.b

Does that information help?

Best,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Find help at http://xtext.itemis.com or xtext(@)itemis.com
Blog: zarnekow.blogspot.com
Twitter: @szarnekow
Google+: https://www.google.com/+SebastianZarnekow
Re: Meaning of: feature was simple feature call but got receiver instead of null [message #1712644 is a reply to message #1712123] Tue, 27 October 2015 06:27 Go to previous message
Udo Walker is currently offline Udo WalkerFriend
Messages: 48
Registered: January 2013
Member
Hi Sebastian,

thanks for your explanation.

I found out that the classpath of my running XbaseInterpreter does not see all referenced types but I cannot figure out how to setup everything.

My interpreter is run in an Eclipse plugin. Some of the input files of the interpreter come from a bundle classpath, some from a project file system. The used classpath are bundles of the running Eclipse.

At the moment I get this exception in Eclipse:

java.lang.ClassCastException: org.eclipse.xtext.common.types.access.jdt.NullJdtTypeProvider cannot be cast to org.eclipse.xtext.common.types.access.impl.ClasspathTypeProvider
at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:35)
at org.eclipse.xtext.common.types.xtext.ClasspathBasedTypeScopeProvider.createTypeScope(ClasspathBasedTypeScopeProvider.java:1)
at org.eclipse.xtext.common.types.xtext.AbstractTypeScopeProvider.getScope(AbstractTypeScopeProvider.java:55)
at org.eclipse.xtext.common.types.xtext.TypesAwareDefaultGlobalScopeProvider.getScope(TypesAwareDefaultGlobalScopeProvider.java:38)
at org.eclipse.xtext.scoping.impl.AbstractGlobalScopeDelegatingScopeProvider.getGlobalScope(AbstractGlobalScopeDelegatingScopeProvider.java:46)
at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getGlobalScope(XImportSectionNamespaceScopeProvider.java:88)
at org.eclipse.xtext.xbase.scoping.XImportSectionNamespaceScopeProvider.getScope(XImportSectionNamespaceScopeProvider.java:82)
at org.eclipse.xtext.xbase.scoping.batch.TypeScopes.createTypeScope(TypeScopes.java:40)
at org.eclipse.xtext.xbase.scoping.batch.AbstractFeatureScopeSession.createTypeScope(AbstractFeatureScopeSession.java:185)
at org.eclipse.xtext.xbase.scoping.batch.AbstractFeatureScopeSession.getScope(AbstractFeatureScopeSession.java:52)
at org.eclipse.xtext.xbase.scoping.batch.TypeLiteralScope.getLocalElementsByName(TypeLiteralScope.java:47)
at org.eclipse.xtext.xbase.scoping.batch.AbstractSessionBasedScope.getElements(AbstractSessionBasedScope.java:184)
at org.eclipse.xtext.xbase.typesystem.internal.ScopeProviderAccess.getCandidateDescriptions(ScopeProviderAccess.java:143)
at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.getLinkingCandidates(AbstractTypeComputationState.java:411)
at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer._computeTypes(XbaseTypeComputer.java:1019)
at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer.computeTypes(XbaseTypeComputer.java:99)
at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.doComputeTypes(AbstractTypeComputationState.java:123)
at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.computeTypes(AbstractTypeComputationState.java:111)
at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer._computeTypes(XbaseTypeComputer.java:660)
at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer.computeTypes(XbaseTypeComputer.java:109)
at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.doComputeTypes(AbstractTypeComputationState.java:123)
at org.eclipse.xtext.xbase.typesystem.internal.AbstractTypeComputationState.computeTypes(AbstractTypeComputationState.java:111)
at org.eclipse.xtext.xbase.typesystem.computation.XbaseTypeComputer._computeTypes(XbaseTypeComputer.java:531)

From reading other forum entries I found out that Xbase cannot find the referenced resources and as fallback uses a NullJdtTypeProvider. But while interpreting there is a ClasspathTypeProvider used.

To summarize:

I have some input files to interpret. They come from a project and/or from a bundle in the running Eclipse (I load them by injecting a XtextResourceSet). All references types point into the running Eclipse in more than 1 bundle.
From the running Eclipse I infer some references to the to be interpreted file (and this works).

How can I configure the XbaseInterpreter to know these bundles at runtime?

With regards,
Udo
Previous Topic:Extending Domainmodel example: Adding own TypeComputer
Next Topic:Xtext performance Issue on serialization
Goto Forum:
  


Current Time: Tue Apr 30 18:34:48 GMT 2024

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

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

Back to the top