Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Strange operation scoping for Numbers and null
Strange operation scoping for Numbers and null [message #907249] Mon, 03 September 2012 16:03 Go to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi,

in my DSL which extends XBase I get a wrong "!=" operator scoping together with "null".

The following code
val Integer myint = 6
if (myint != null)
	true
else
	false

will be scoped to the following method which is of course not true:
boolean IntegerExtensions.operator_notEquals(int arg0, short arg1)

I'm using Xtext 2.3.1 but the error was also in earlier version.

Any hint on why this is happending or where to investigate further?

Thanks in advance,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907301 is a reply to message #907249] Mon, 03 September 2012 17:54 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

make sure xbase.lib is on the classpath of the project containing the model file.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange operation scoping for Numbers and null [message #907309 is a reply to message #907301] Mon, 03 September 2012 18:19 Go to previous messageGo to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Thanks Christian, I should have mention that in my initial post...
All libraries are of course on the classpath, otherwise the linking to "boolean org.eclipse.xtext.xbase.lib.IntegerExtensions.operator_notEquals(int arg0, short arg1)" would not have been done Wink

The problem only occurs if 2nd argument is null, so for all "Number != null"

~Ingo

[Updated on: Mon, 03 September 2012 18:20]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907311 is a reply to message #907309] Mon, 03 September 2012 18:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

can you share a reproducable grammar?



Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange operation scoping for Numbers and null [message #907313 is a reply to message #907309] Mon, 03 September 2012 18:23 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

can you share a reproducable grammar?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Strange operation scoping for Numbers and null [message #907337 is a reply to message #907309] Mon, 03 September 2012 19:41 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Am 03.09.12 20:19, schrieb Ingo Meyer:
> Thanks cristian, I should have mention that in my initial post...
> All libraries are of course on the classpath, otherwise the linking to
> "boolean
> org.eclipse.xtext.xbase.lib.IntegerExtensions.operator_notEquals(int
> arg0, short arg1)" would not have been done ;)
>
> The problem only occurs if 2nd argument is null, so for all "Number !=
> null"
>
> ~Ingo

Hi Ingo,

that's unfortunately an issue with the current linking in Xbase. It
sometime confuses overloaded methods such as '+' or '!=' which are
available by more than one extension class. I'm afraid you'll have to
cast the Integer to Object. Sorry for any inconcenience cause. We are
currently reworking the linking to make sure that such things do not
happen any more.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Strange operation scoping for Numbers and null [message #907618 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous messageGo to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:
left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
	return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
	return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907619 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous messageGo to next message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:13]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907621 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:13]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907630 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:14]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907631 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:14]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907632 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:14]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907643 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:14]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907644 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:14]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907645 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Dublicate caused by Forum malfunction!

[Updated on: Tue, 04 September 2012 09:15]

Report message to a moderator

Re: Strange operation scoping for Numbers and null [message #907652 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907653 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907654 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907663 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907664 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907665 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907677 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907678 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907679 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907691 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907692 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907693 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907710 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907711 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907712 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907733 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907734 is a reply to message #907337] Tue, 04 September 2012 08:19 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Re: Strange operation scoping for Numbers and null [message #907735 is a reply to message #907337] Tue, 04 September 2012 08:22 Go to previous message
Ingo Meyer is currently offline Ingo MeyerFriend
Messages: 162
Registered: July 2009
Senior Member
Hi Sebastian, Hi Christian,

thanks for the hint.
As I was not able to create a reproducable example, I decided to dive deeper into my code.
I found some very old stuff in my TypeConformanceComputer, which is at least partly responsible for my problem.
In my DSL I want all Numbers to be conformant and my Generator is then responsible for doing the correct transformation in Java. Thats why I had that code in my #isConformant() method:

left = primitives.asWrapperTypeIfPrimitive( left );
right = primitives.asWrapperTypeIfPrimitive( right );

if (typeRefs.isInstanceOf( left, Number.class ) && typeRefs.isInstanceOf( right, Number.class ))
return TypeConformanceResult.SUCCESS;

final TypeConformanceResult result = super.isConformant( left, right, flags );
if (result.isConformant())
return result;


But it is not a good idea to do the wrapping BEFORE the super call. I just moved it after the super call to just be executed when super class returns no success.
Now my linking for primitive numbers is much more as excepted.

Thanks,
~Ingo
Previous Topic:Unique names validation - Builder required?
Next Topic:import a model into an editor
Goto Forum:
  


Current Time: Thu Mar 28 09:42:41 GMT 2024

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

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

Back to the top