Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » JvmTypeReference and eIsProxy
JvmTypeReference and eIsProxy [message #1696704] Thu, 28 May 2015 06:20 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
Hi

while working on https://bugs.eclipse.org/bugs/show_bug.cgi?id=468174 I
noted that in the JvmTypesBuilder in two places eIsProxy() is checked on
a JvmTypeReference; from what I understand, a JvmTypeReference will
never be a proxy, since it represents a reference, but it is not an EMF
reference itself; it is the contained JvmType that can be a proxy.

In particular, in the implementation of toGetter you read

if (typeRef != null && !typeRef.eIsProxy() &&
!InferredTypeIndicator.isInferred(typeRef)
&& typeRef.getType()!=null
&& !typeRef.getType().eIsProxy() &&
"boolean".equals(typeRef.getType().getIdentifier())) {
prefix = "is";
}

I guess the intention here is not to trigger type resolution, but indeed
type resolution is triggered by typeRef.getType() (and again,
typeRef.eIsProxy() will always return false.

Shouldn't JvmTypeReference.eIsProxy() be implemented in terms of
"type.eIsProxy()"?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: JvmTypeReference and eIsProxy [message #1696773 is a reply to message #1696704] Thu, 28 May 2015 13:46 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Yes, that's a bug.
Re: JvmTypeReference and eIsProxy [message #1696777 is a reply to message #1696773] Thu, 28 May 2015 14:04 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 28/05/2015 15:46, Sven Efftinge wrote:
> Yes, that's a bug.

OK, I'll submit a bug shortly, with a patch proposal:
at least, I think the important thing is that scoping is not triggered
on the original type reference, but on the cloned one.

I'm not planning to touch eIsProxy implementation.

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: JvmTypeReference and eIsProxy [message #1696780 is a reply to message #1696777] Thu, 28 May 2015 14:13 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
using typeRef.eGet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, false) and checking what is returned for eIsProxy should work.
Re: JvmTypeReference and eIsProxy [message #1696788 is a reply to message #1696780] Thu, 28 May 2015 14:45 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 28/05/2015 16:13, Sven Efftinge wrote:
> using
> typeRef.eGet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
> false) and checking what is returned for eIsProxy should work.

Hi

I created the bug

https://bugs.eclipse.org/bugs/show_bug.cgi?id=468641

should we continue the discussion there?

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Re: JvmTypeReference and eIsProxy [message #1696797 is a reply to message #1696788] Thu, 28 May 2015 15:01 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1775
Registered: July 2009
Location: Firenze, Italy
Senior Member
On 28/05/2015 16:45, Lorenzo Bettini wrote:
> On 28/05/2015 16:13, Sven Efftinge wrote:
>> using
>> typeRef.eGet(TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE,
>> false) and checking what is returned for eIsProxy should work.
>
> Hi
>
> I created the bug
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=468641
>
> should we continue the discussion there?

Because that won't work for XFunctionTypeRef: in that case the returned
value is the list (EObjectContainmentEList) of parameter types...


--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book


Previous Topic:File extension conflict
Next Topic:Trying XText for IntelliJ
Goto Forum:
  


Current Time: Thu Apr 15 04:17:22 GMT 2021

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

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

Back to the top