Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » M2M (model-to-model transformation) » [QVTO] Number Conversion Issue
[QVTO] Number Conversion Issue [message #104811] Mon, 11 May 2009 00:38 Go to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
This is my first post to the group, so I hope this is a worthwhile
place to post this question (and my potential resolution). During some
headless QVTO testing I was getting errors about casting Floats to
Doubles (between two EMF models with generated and pre-compiled Java
classes). I had a look into the QVTO runtime source and found that in
the org/eclipse/m2m/internal/qvt/oml/evaluator/NumberConversions .java
file the test for number conversion was checking if a target
attribute's instance type were of the Object type (e.g. Integer.class,
Double.class, Boolean.class etc.) and our problem was that the
attributes reported their instance class as being the primitive class
(e.g. int.class, double.class and boolean.class)

I made a change to the NumberConversion.java file so that this would be
taken into account (assuming that Java 1.5+ autoboxing would take care
of the conversions to the primitives) and this patch to the
NumberConversions.java file fixed this issue for us. I was wondering
whether this is something that should be included in the main QVT
source or if that behaviour is what is expected (and so whether we need
to work around it).

I generated a patch in Eclipse which you can grab here:
http://cimphony.org/org.eclipse.m2m.qvt.oml.patch

Cheers

Alan
Re: [QVTO] Number Conversion Issue [message #104840 is a reply to message #104811] Mon, 11 May 2009 10:08 Go to previous messageGo to next message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Alan,

Thanks for catching the problem. You even digged into the source code and
provided
a fix, which is great!

Yes, this is this the right and I guess the only place to post such a
question ;),
however the bugzilla is great too, especially if you provide a patch.

Could you please raise a new bugzilla here?
https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2M& component=QVT_OML-Engine

It's not just to add more work for you ;), but to help us easily track
contributions
so you can appear in the IP log of our project.

Would be great if you provide a QVT code snippet to reproduce the issue.

Regards,
/Radek


On Mon, 11 May 2009 11:33:45 +0200, wrote:

> On Mon, 11 May 2009 02:38:19 +0200, Alan McMorran <alan@mcmorran.co.uk>
> wrote:
>
>> This is my first post to the group, so I hope this is a worthwhile
>> place to post this question (and my potential resolution). During some
>> headless QVTO testing I was getting errors about casting Floats to
>> Doubles (between two EMF models with generated and pre-compiled Java
>> classes). I had a look into the QVTO runtime source and found that in
>> the org/eclipse/m2m/internal/qvt/oml/evaluator/NumberConversions .java
>> file the test for number conversion was checking if a target
>> attribute's instance type were of the Object type (e.g. Integer.class,
>> Double.class, Boolean.class etc.) and our problem was that the
>> attributes reported their instance class as being the primitive class
>> (e.g. int.class, double.class and boolean.class)
>>
>> I made a change to the NumberConversion.java file so that this would be
>> taken into account (assuming that Java 1.5+ autoboxing would take care
>> of the conversions to the primitives) and this patch to the
>> NumberConversions.java file fixed this issue for us. I was wondering
>> whether this is something that should be included in the main QVT
>> source or if that behaviour is what is expected (and so whether we need
>> to work around it).
>>
>> I generated a patch in Eclipse which you can grab here:
>> http://cimphony.org/org.eclipse.m2m.qvt.oml.patch
>>
>> Cheers
>>
>> Alan
>>
>
Re: [QVTO] Number Conversion Issue [message #104937 is a reply to message #104840] Tue, 12 May 2009 09:17 Go to previous messageGo to next message
Alan McMorran is currently offline Alan McMorranFriend
Messages: 55
Registered: July 2009
Member
On 2009-05-11 12:08:03 +0200, "Radek Dvorak" <radek.dvorak@borland.com> said:

> Hi Alan,
>
> Thanks for catching the problem. You even digged into the source code
> and provided
> a fix, which is great!

Not a problem, figured I might as well make use of it being open-source
:-) Still happier digging about in Java code than QVT at the moment
anyway!

> Yes, this is this the right and I guess the only place to post such a
> question ;),
> however the bugzilla is great too, especially if you provide a patch.
>
> Could you please raise a new bugzilla here?
> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2M& component=QVT_OML-Engine

It's
>
> not just to add more work for you ;), but to help us easily track
> contributions
> so you can appear in the IP log of our project.

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

Done!

> Would be great if you provide a QVT code snippet to reproduce the issue.

I can't include the actual models or transforms due to contractual
agreements but it was actually just pretty simple EFloat to a custom
datatype of instance type double.class (i.e. a duplicate of EDouble)
and I think the main issue has been that the transform was working with
Genmodel generated Java class files for both models (as opposed to
Dynamic models).

Cheers

Alan
Re: [QVTO] Number Conversion Issue [message #104952 is a reply to message #104937] Tue, 12 May 2009 10:25 Go to previous message
Radomil Dvorak is currently offline Radomil DvorakFriend
Messages: 249
Registered: July 2009
Senior Member
Hi Alan,

Thanks!
No need for the actual models, just wanted to know the context of usage,
like
assignment, cast or numeric operation etc., exactly as you did in the
bugzilla.

Regards,
/Radek


On Tue, 12 May 2009 11:17:21 +0200, Alan McMorran <alan@mcmorran.co.uk>
wrote:

> On 2009-05-11 12:08:03 +0200, "Radek Dvorak" <radek.dvorak@borland.com>
> said:
>
>> Hi Alan,
>> Thanks for catching the problem. You even digged into the source code
>> and provided
>> a fix, which is great!
>
> Not a problem, figured I might as well make use of it being open-source
> :-) Still happier digging about in Java code than QVT at the moment
> anyway!
>
>> Yes, this is this the right and I guess the only place to post such a
>> question ;),
>> however the bugzilla is great too, especially if you provide a patch.
>> Could you please raise a new bugzilla here?
>> https://bugs.eclipse.org/bugs/enter_bug.cgi?product=M2M& component=QVT_OML-Engine
>
> It's
>> not just to add more work for you ;), but to help us easily track
>> contributions
>> so you can appear in the IP log of our project.
>
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=275824
>
> Done!
>
>> Would be great if you provide a QVT code snippet to reproduce the issue.
>
> I can't include the actual models or transforms due to contractual
> agreements but it was actually just pretty simple EFloat to a custom
> datatype of instance type double.class (i.e. a duplicate of EDouble) and
> I think the main issue has been that the transform was working with
> Genmodel generated Java class files for both models (as opposed to
> Dynamic models).
>
> Cheers
>
> Alan
>
Previous Topic:[ATL] A Problem with atl transformation to Ecore
Next Topic:[ATL] Compiling an EMFModel with the 3.0.0M7 (2009/05/05) ATL version API?
Goto Forum:
  


Current Time: Fri Apr 19 21:13:11 GMT 2024

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

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

Back to the top