Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Replacement for TypeReferences.isInstanceof()
Replacement for TypeReferences.isInstanceof() [message #1402093] Wed, 16 July 2014 14:01 Go to next message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi,

After upgrading from Xtext 2.4 to 2.6 we noticed that the method
org.eclipse.xtext.common.types.util.TypeReferences.isInstanceOf(JvmTypeReference, Class<?>)
has been removed.

We used this method to validate the JvmType references of our model (whether they implement certain interfaces).

What is the recommended way to do this kind of validation with Xtext 2.6?
I checked LightweightTypeReference.isSubtypeOf() but I had the impression that the environments in which this method is used are rather connected with Xbase.
Our grammar is not based on Xbase.

Thank you in advance,
Csaba

Re: Replacement for TypeReferences.isInstanceof() [message #1402146 is a reply to message #1402093] Wed, 16 July 2014 15:33 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
did you try org.eclipse.xtext.common.types.util.TypeReferences.is(JvmTypeReference, Class<?>)

Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Replacement for TypeReferences.isInstanceof() [message #1402550 is a reply to message #1402146] Thu, 17 July 2014 06:29 Go to previous message
Csaba Koncz is currently offline Csaba KonczFriend
Messages: 49
Registered: July 2009
Member
Hi Christian,

I did not try the "is" method, only looked at its implementation and from that it seems that it only checks qualified name equality. The implementation of the old "isInstanceOf" walked the superclass hierarchy and invoked "is" to find a match.

I also checked the commit that introduced the change to find out what is used now instead of the removed method (https://git.eclipse.org/r/#/c/21954/9), but could not find an Xbase-free usage.

Csaba
Previous Topic:No EObjectDescription could be found in Scope
Next Topic:Weird behavior using "Project/Clean.." in Eclipse
Goto Forum:
  


Current Time: Fri Apr 19 12:09:18 GMT 2024

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

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

Back to the top