Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Getting a reference to the class we are working with fails
Getting a reference to the class we are working with fails [message #949878] Fri, 19 October 2012 11:54 Go to next message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
In the following construct I expected structClassRef shouldn't be null:
acceptor.accept(structDef.toClass(structClassName)).initializeLater [
    documentation = structDef.documentation
    val structClassRef = structDef.newTypeRef(structClassName)
    ...
]

since it's only called after indexing and after a class with this name is registered. But as it happens, I _do_ get null here sometimes. What am I misunderstanding?
Re: Getting a reference to the class we are working with fails [message #949917 is a reply to message #949878] Fri, 19 October 2012 12:36 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 19.10.12 13:54, schrieb Alexey Romanov:
> In the following construct I expected structClassRef shouldn't be null:
>
> acceptor.accept(structDef.toClass(structClassName)).initializeLater [
> documentation = structDef.documentation
> val structClassRef = structDef.newTypeRef(structClassName)
> ...
> ]
>
> since it's only called after indexing and after a class with this name
> is registered. But as it happens, I _do_ get null here sometimes. What
> am I misunderstanding?

What do you mean by 'sometimes'?

Please note that the structClass is available under the local name 'it'
so it may be easier to put that one into a newly create
JvmParameterizedTypeReference.setType(it)

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Getting a reference to the class we are working with fails [message #986348 is a reply to message #949917] Tue, 20 November 2012 08:10 Go to previous message
Alexey Romanov is currently offline Alexey RomanovFriend
Messages: 263
Registered: May 2010
Senior Member
It now looks like the problem happens when I try to do anything with cross-references outside initializeLater block (which I was doing to eliminate some duplication).
Previous Topic:Scoping and cross-references
Next Topic:Xtext + FormEditor
Goto Forum:
  


Current Time: Tue Apr 23 07:35:07 GMT 2024

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

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

Back to the top