Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Lazy Linking is broken in 2.3(... and a small rant about XText in general)
icon13.gif  Lazy Linking is broken in 2.3 [message #892968] Mon, 02 July 2012 08:03 Go to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
Hi,
Sorry for the rant, but: EVERY single time, when a minor revision was incremented XText breaks for me. A few years ago it broke so bad that I decided to leave it alone as it seemed too immature for production. I think the major problem here is the lack of documentation. If you do not know how you're supposed to code something, then you are using it in ways that are not intended by the XText devs and thus fail upon upgrades. This is especially true for the scoping part which also is found as a frequently asked question in this forum.

As for my problem: I have a bunch of JUnit tests that are checking various properties of my model etc. They all work very fine in 2.2, but in 2.3 all of those with references to other files are failing me with a ERROR:Couldn't resolve reference to BlaBla
This later on turns into a NPE:
java.lang.NullPointerException
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getResourceScope(ImportedNamespaceAwareLocalScopeProvider.java:95)
at org.eclipse.xtext.scoping.impl.ImportedNamespaceAwareLocalScopeProvider.getScope(ImportedNamespaceAwareLocalScopeProvider.java:89)
at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.delegateGetScope(AbstractDeclarativeScopeProvider.java:72)
at org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.getScope(AbstractDeclarativeScopeProvider.java:102)

I am using ResourceSetScopes and ImportedNamespaces. Also note that as with my other problem, the GUI behaves differently then the JUnit tests.
Re: Lazy Linking is broken in 2.3 [message #892975 is a reply to message #892968] Mon, 02 July 2012 08:14 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13359
Registered: July 2009
Senior Member
Hi could you Check if you ran into
https://bugs.eclipse.org/bugs/show_bug.cgi?id=382555

--
--Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@xxxxxxxx


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Lazy Linking is broken in 2.3 [message #892976 is a reply to message #892975] Mon, 02 July 2012 08:20 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
Ahh, yes. That solves the problem. Thanks!
Re: Lazy Linking is broken in 2.3 [message #892980 is a reply to message #892976] Mon, 02 July 2012 08:25 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
Now only one breaking change remains:
org.eclipse.emf.ecore.resource.impl.ResourceSetImpl$1DiagnosticWrappedException: java.io.FileNotFoundException: BlaBla.pshdl (No such file or directory)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.handleDemandLoadException(ResourceSetImpl.java:319)
at org.eclipse.emf.ecore.resource.impl.ResourceSetImpl.demandLoadHelper(ResourceSetImpl.java:278)
at org.eclipse.xtext.resource.XtextResourceSet.getResource(XtextResourceSet.java:159)

I create a Model for some runtime generated Interface that I then can reference. In 2.2 I simply created a resource for it and added it to the resourceset. There was no need for it to physically exist which was great as this is exactly what I want. But now it appears that I need to perform a save on the resources. Is there any way around that?
Re: Lazy Linking is broken in 2.3 [message #892985 is a reply to message #892980] Mon, 02 July 2012 08:32 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13359
Registered: July 2009
Senior Member
Shouldnt you all create resource then or load the resource with a
stream? Can you elaborate a bit what you are doing in the test?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext@xxxxxxxx


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Lazy Linking is broken in 2.3 [message #892996 is a reply to message #892985] Mon, 02 July 2012 08:52 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
The best way to think of it is when you imagine a Java class that is created on the fly. I have a factory where I can say: Create 5 fields and 2 methods with those names. The class is then created and I can reference the fields and methods from my model.
To get this working with the Scoping mechanism, I create an Interface which I tell the Scope to use. This works pretty fine, even with the UI features. But this interface really just exists in memory and there is no real need to write it to a file.
It goes a little into this direction of another thread I posted: "Correct scoping for "virtual" references"
Re: Lazy Linking is broken in 2.3 [message #892998 is a reply to message #892985] Mon, 02 July 2012 08:53 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
EDIT:Double post, sorry

[Updated on: Mon, 02 July 2012 08:54]

Report message to a moderator

Re: Lazy Linking is broken in 2.3 [message #893046 is a reply to message #892996] Mon, 02 July 2012 12:17 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3107
Registered: July 2009
Senior Member
#createResource instead of #getResource does not work for you iff the
resource is not yet contained in the resource set?

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

Am 02.07.12 10:52, schrieb Karsten Becker:
> The best way to think of it is when you imagine a Java class that is
> created on the fly. I have a factory where I can say: Create 5 fields
> and 2 methods with those names. The class is then created and I can
> reference the fields and methods from my model.
> To get this working with the Scoping mechanism, I create an Interface
> which I tell the Scope to use. This works pretty fine, even with the UI
> features. But this interface really just exists in memory and there is
> no real need to write it to a file.
> It goes a little into this direction of another thread I posted:
> "Correct scoping for "virtual" references"
Re: Lazy Linking is broken in 2.3 [message #893134 is a reply to message #893046] Mon, 02 July 2012 19:56 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
I used createResource before. But the problem of createResource is that I might add the same URI twice which now gives the exception:
java.lang.IllegalStateException: A resource with the normalized URI 'file:/Volumes/Macintosh%20HD/Users/karstenbecker/Dropbox/pshdl/de.tuhh.ict.pshdl.v2.tests/src-gen/com.pts.motor.MotorControllerUserLogic.PLBCore.pshdl' was already registered. The resource with the URI 'org.eclipse.xtext.linking.lazy.LazyLinkingResource@22162667 uri='src-gen/com.pts.motor.MotorControllerUserLogic.PLBCore.pshdl'' is no longer registered with the normalized form.
Re: Lazy Linking is broken in 2.3 [message #893135 is a reply to message #893134] Mon, 02 July 2012 19:59 Go to previous messageGo to next message
Karsten Becker is currently offline Karsten BeckerFriend
Messages: 12
Registered: July 2009
Junior Member
Just for testing I added a HashSet to check if I already added it. (This is suboptimal as I might have added the same resource to another resourceset...)
It doesn't solve the problem.
Re: Lazy Linking is broken in 2.3 [message #893429 is a reply to message #892968] Wed, 04 July 2012 07:21 Go to previous message
Jos Warmer is currently offline Jos WarmerFriend
Messages: 114
Registered: October 2010
Senior Member
Hi, I run into the same problem, but cannot change the code for applying the fix. As this is fixed in 2.3.1, when can we expect this version to be released?

Jos
Previous Topic:How to display multiple errors for same objects used more than once
Next Topic:Script with condition
Goto Forum:
  


Current Time: Sun Feb 23 14:54:49 GMT 2020

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

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

Back to the top