| vadim |
 |
Thursday, November 20 2008 @ 03:33 PM CET (Read 888 times) |
|
|
|
Status: offline
Registered: 08/14/08
Posts: 5
|
Eclipse xtend editor seems to flag the following code with an error "boolean not found"
cached String foreignKey(String className,Boolean underscore):
JAVA ...MyClass.foreignKey(java.lang.String,boolean);
However code actually compiles and works fine. Is there some other way to indicate passing of primitive types to JAVA extension? I get the same error for "int" as well.
|
| |
|
|
| Meinte Boersma |
 |
Thursday, November 20 2008 @ 03:58 PM CET |
|
|

Expert
 Status: offline
Registered: 10/20/07
Posts: 940
|
This is a feature, since Xtend doesn't try and map primitive types. Instead, provide the class name for the corresponding wrapper class.
|
| |
|
|
| vadim |
 |
Thursday, November 20 2008 @ 04:30 PM CET |
|
|
|
Status: offline
Registered: 08/14/08
Posts: 5
|
You saying that I should use java.lang.Boolean and change the JAVA api correspondingly? I tried it and it does work.
I'll use this workaround but I still think it's a minor bug :). Since code compiles and works with autoboxing be nice if editor supported it...
Thanks.
|
| |
|
|
| Meinte Boersma |
 |
Thursday, November 20 2008 @ 04:43 PM CET |
|
|

Expert
 Status: offline
Registered: 10/20/07
Posts: 940
|
It's definitely not a bug, as primitive types do not exist in the same way in oAW's type system. It only adds extra fluff and stuff in a place where it's rarely needed (only be lazy programmers!) and with the only purpose to work around a design "feature" of Java.
|
| |
|
|
| vadim |
 |
Thursday, November 20 2008 @ 05:07 PM CET |
|
|
|
Status: offline
Registered: 08/14/08
Posts: 5
|
I disagree that using primitive types is lazy. But I agree that adding primitive types into OAW would be overkill. One could argue that specifying java.lang.Blah should match functions that take either wrapper or primitive class, as that what Java does, but I will not. I will change my JAVA code to use wrappers. It's not a big deal...
Thanks a lot,
Vadim
|
| |
|
|
| Meinte Boersma |
 |
Thursday, November 20 2008 @ 05:49 PM CET |
|
|

Expert
 Status: offline
Registered: 10/20/07
Posts: 940
|
What I meant was that using primitives in the oAW context reeks of lazyness
The JAVA extension business is a bit of a workaround in itself: specifiying the Java types like this is only necessary to bridge the gap between polymorphic dispatch of Xtend/Xpand and static dispatch of Java.
|
| |
|
|
| vadim |
 |
Thursday, November 20 2008 @ 06:19 PM CET |
|
|
|
Status: offline
Registered: 08/14/08
Posts: 5
|
What confused me actually wasn't the fact that this wasn't supported but inconsistency between editor and generator. Generator worked fine but editor was claiming that it's an error and shouldn't work. This is why I thought it was a bug, because the generator worked with it, but editor flagged it.
|
| |
|
|
| Meinte Boersma |
 |
Thursday, November 20 2008 @ 06:26 PM CET |
|
|

Expert
 Status: offline
Registered: 10/20/07
Posts: 940
|
Oh sorry, didn't understand it was an inconsistency between editor and at runtime: in which case it would be a bug
|
| |
|
|
| Karsten Thoms |
 |
Thursday, November 20 2008 @ 06:32 PM CET |
|
|
 Status: offline
Registered: 07/20/05
Posts: 1859
|
Try to strip your case down to a reproducable example and open a bug. We would solve your issue then.
Inconsistency between editor and runtime occurs sometimes. This is totally different code executed. The editor calls Expression#analyze(), the runtime Expression#evaluate().
Since normally all works fine it is especially important for us to have concrete scenarios to examine.
Kind regards,
~Karsten
|
| |
|
|