Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problems with scoping after migrating to xtext 2.0
Problems with scoping after migrating to xtext 2.0 [message #715424] Sat, 13 August 2011 23:43 Go to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi anybody,

I have a very strange behaviour in my scoping since migrated to xtext 2.0
There is a method getLocalElementsByEObject(Eobject, URI) in the class SimpleScope, which is called.

This calls getAllLocalElements() in the first line.
Afterwards in the filtermethod canBeFoundByNameAndShadowingKey() the method getLocalElementsByName() is called.

In my setup the first methodcall of getAllLocalElements() clears the complete iterator, so it's empty if the second method is called. This leads to non finding the searched element.

Is this a common bug or can you give me a hint why iterator-elements are removed? What's wrong?

Best regards
Markus
Re: Problems with scoping after migrating to xtext 2.0 [message #715609 is a reply to message #715424] Sun, 14 August 2011 19:59 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi,

what do you mean with "clears"? i don't know of such problems. maybe the iterable (that is passed via constructor) is cleared from outside.
are you sure that there are elements at all when the simplescope is constructed?

~Christian


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with scoping after migrating to xtext 2.0 [message #715622 is a reply to message #715609] Sun, 14 August 2011 22:03 Go to previous messageGo to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Yes, I see elements in this iterable via debugger, but after second access it's empty

Re: Problems with scoping after migrating to xtext 2.0 [message #715660 is a reply to message #715622] Mon, 15 August 2011 04:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi, still the question: are you sure that its the same iterable/simple scope instance in both cases? Can you Share a reproducable example? ~Christian

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with scoping after migrating to xtext 2.0 [message #716272 is a reply to message #715660] Tue, 16 August 2011 20:40 Go to previous messageGo to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi Christian,

I got it.... solved the bug, but don't exactly know why (Extracting a example is not that easy, sorry)....



Iterable<IEObjectDescription> concat = Iterables.concat(Iterables.transform(new SuperDomainIterable(dom),
new Function<Domain, Iterable<IEObjectDescription>>() {
public Iterable<IEObjectDescription> apply(Domain from) {
Iterable<EObject> allContents2 = allContents(from, filter);
for (EObject nextObject: allContents2)
LOGGER.info("nextObject: " + nextObject.toString());

return transform(allContents2, new QualifiedNameFunction(from));
}
}));


This was the Iterable, the scope was filled with.

I added the following lines:
//In SimpleScope
ArrayList <IEObjectDescription> list = new ArrayList<IEObjectDescription>();
Iterator <IEObjectDescription> it = concat.iterator();
while (it.hasNext()) {
list.add(it.next());
}


and gave the list to the simplescope. Now it doesn't disappear anymore and the reference is resolvable. I can iterate multiple times now.

Perhaps you can give me a hint, I'm nosy what's the real problem, nevertheless I have a solution for me

Best regards
Markus

[Updated on: Tue, 16 August 2011 20:40]

Report message to a moderator

Re: Problems with scoping after migrating to xtext 2.0 [message #721653 is a reply to message #715660] Fri, 02 September 2011 12:38 Go to previous messageGo to next message
Markus Oley is currently offline Markus OleyFriend
Messages: 301
Registered: July 2009
Location: Germany
Senior Member
Hi Christian,

the problem was a complete different....
the index was built in a wrong way,

Best regards
Markus
Re: Problems with scoping after migrating to xtext 2.0 [message #1146535 is a reply to message #721653] Sun, 20 October 2013 07:52 Go to previous messageGo to next message
Hirdesh Agrawal is currently offline Hirdesh AgrawalFriend
Messages: 13
Registered: October 2013
Junior Member
Dear All,

I need your favor or suggestion regarding migrate the xtext version from 1.0.1 to 2.3.0 in custom application.

I followed all following process for migrate the xtext version.
1. Delete the old plug-ins and update the latest plug-ins in target platform.
2. Update the Plug-in Dependencies and Import Statements.
3. Introduction of the Qualified Name.
4. Changes in the index and in find references.
5. Rewritten Node Model.
6. AutoEditStrategy.
7. Other Noteworthy API Changes
To consider the above steps, I started the work with Eclipse-4.2, Which has a xtext-2.3.0 dependency. Successfully I completed the all above steps and removed the compilation error.

Problem: After that I start the testing and getting below error Messages:
[XtextLinkingDiagnostic: null:6 Couldn't resolve reference to Material 'MPS_RECUR'.,
XtextLinkingDiagnostic: null:9 Couldn't resolve reference to Cstic 'NUM_OF_ALLOC'.,
XtextLinkingDiagnostic: null:15 Couldn't resolve reference to Cstic 'INSTANCE_NUM'.,
XtextLinkingDiagnostic: null:14 Couldn't resolve reference to Class 'ALLOC'.]
Re: Problems with scoping after migrating to xtext 2.0 [message #1146586 is a reply to message #1146535] Sun, 20 October 2013 08:41 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi Posting the Same post will Not help.
Posting without any Detail will help less


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with scoping after migrating to xtext 2.0 [message #1146599 is a reply to message #1146586] Sun, 20 October 2013 08:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
P.S: did you follow the steps from http://www.eclipse.org/Xtext/documentation.html#migrating_from_1_0_x ??

Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problems with scoping after migrating to xtext 2.0 [message #1148284 is a reply to message #1146599] Mon, 21 October 2013 11:51 Go to previous messageGo to next message
Hirdesh Agrawal is currently offline Hirdesh AgrawalFriend
Messages: 13
Registered: October 2013
Junior Member
Thanks for reply I followed the same steps as document suggested.

I am getting the error in BasicEObjectImpl.eInternalResource() method
mainly result = eContainer.eDirectResource(); has a error at 938 line number
public Resource.Internal eInternalResource()
{
Resource.Internal result = eDirectResource();
if (result == null)
{
int count = 0;
for (InternalEObject eContainer = eInternalContainer(); eContainer != null; eContainer = eContainer.eInternalContainer())
{
// Since the cycle is detected by checking if we hit "this" again, after many iterations we'll call this method recursively
// in case we started with something that wasn't part of a cycle but later traversed up to a cycle.
//
if (++count > 100000)
{
return eContainer.eInternalResource();
}
result = eContainer.eDirectResource();
if (result != null || eContainer == this)
{
break;
}
}
}
return result;
}

Re: Problems with scoping after migrating to xtext 2.0 [message #1148338 is a reply to message #1148284] Mon, 21 October 2013 12:35 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13667
Registered: July 2009
Senior Member
Hi,

this is not what i meant.

the error says: your scoping is screwed up.
i dont know how your grammar works.
i dont know how your scoping works
i dont know how your language workflow looks like
i dont know how your test model looks like
...


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Terminal rules driving me nuts
Next Topic:Xtext grammar question (XIntLiteral cannot be resolved to a rule)
Goto Forum:
  


Current Time: Thu Dec 03 09:02:03 GMT 2020

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

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

Back to the top