Skip to main content



      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 19:43 Go to next message
Eclipse UserFriend
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 15:59 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Problems with scoping after migrating to xtext 2.0 [message #715622 is a reply to message #715609] Sun, 14 August 2011 18:03 Go to previous messageGo to next message
Eclipse UserFriend
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 00:41 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: Problems with scoping after migrating to xtext 2.0 [message #716272 is a reply to message #715660] Tue, 16 August 2011 16:40 Go to previous messageGo to next message
Eclipse UserFriend
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 16:40] by Moderator

Re: Problems with scoping after migrating to xtext 2.0 [message #721653 is a reply to message #715660] Fri, 02 September 2011 08:38 Go to previous messageGo to next message
Eclipse UserFriend
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 03:52 Go to previous messageGo to next message
Eclipse UserFriend
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 04:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Posting the Same post will Not help.
Posting without any Detail will help less
Re: Problems with scoping after migrating to xtext 2.0 [message #1146599 is a reply to message #1146586] Sun, 20 October 2013 04:55 Go to previous messageGo to next message
Eclipse UserFriend
P.S: did you follow the steps from http://www.eclipse.org/Xtext/documentation.html#migrating_from_1_0_x ??
Re: Problems with scoping after migrating to xtext 2.0 [message #1148284 is a reply to message #1146599] Mon, 21 October 2013 07:51 Go to previous messageGo to next message
Eclipse UserFriend
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 08:35 Go to previous message
Eclipse UserFriend
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
...
Previous Topic:Terminal rules driving me nuts
Next Topic:Xtext grammar question (XIntLiteral cannot be resolved to a rule)
Goto Forum:
  


Current Time: Thu Jul 24 18:56:42 EDT 2025

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

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

Back to the top