openArchitectureWare.org

oAW has moved to Eclipse.

At this site you will find information about the outdated version openArchitectureWare 4, only.
Please read our letter of intent for further information.

 

 Forum Index > openArchitectureWare > openArchitectureWare 4.x Support New Topic Post Reply
 Xtend editor flags JAVA extension error for primitive types
 |  Printable Version
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.


 
Profile Email
Quote
Meinte Boersma
 Thursday, November 20 2008 @ 03:58 PM CET  
Forum Expert
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.


 
Profile Email
Quote
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.


 
Profile Email
Quote
Meinte Boersma
 Thursday, November 20 2008 @ 04:43 PM CET  
Forum Expert
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.


 
Profile Email
Quote
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


 
Profile Email
Quote
Meinte Boersma
 Thursday, November 20 2008 @ 05:49 PM CET  
Forum Expert
Expert

Status: offline

Registered: 10/20/07
Posts: 940

What I meant was that using primitives in the oAW context reeks of lazyness Wink

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.


 
Profile Email
Quote
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.



 
Profile Email
Quote
Meinte Boersma
 Thursday, November 20 2008 @ 06:26 PM CET  
Forum Expert
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 Oops!


 
Profile Email
Quote
Karsten Thoms
 Thursday, November 20 2008 @ 06:32 PM CET  
Forum

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


 
Profile Email Website
Quote
Content generated in: 0.09 seconds
New Topic Post Reply



 All times are CEST. The time is now 06:46 AM.
Normal Topic Normal Topic
Locked Topic Locked Topic
Sticky Topic Sticky Topic
New Post New Post
Sticky Topic W/ New Post Sticky Topic W/ New Post
Locked Topic W/ New Post Locked Topic W/ New Post
View Anonymous Posts 
Anonymous users can post 
Filtered HTML Allowed 
Censored Content