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 07:54 Go to next message
Alexey Romanov is currently offline Alexey Romanov
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 08:36 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian Zarnekow
Messages: 2809
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 03:10 Go to previous message
Alexey Romanov is currently offline Alexey Romanov
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: Fri Aug 22 01:56:29 EDT 2014

Powered by FUDForum. Page generated in 0.12227 seconds