Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] eliminate warnings([Acceleo] eliminate warnings)
[Acceleo] eliminate warnings [message #654814] Thu, 17 February 2011 09:45 Go to next message
olafo987  is currently offline olafo987
Messages: 13
Registered: November 2010
Junior Member
Hello
First, I apologize for my poor Inglish.

I'm working at one project with "Acceleo" and I have the need of eliminate multiples "warnings" that I have. I have very code as this:

[query public hasParameterTypeByName(c : Class, parameterName : String) : Boolean = (c.ownedOperation->asSequence()->collect(ownedParameter)->select(p : Parameter | p.type.name.equalsIgnoreCase(parameterName))->size() > 0) /]

[template public templateImportsSpecialsParameters(c : Class) post (trim())]
[if (c.hasParameterTypeByName('BigDecimal'))]
import java.math.BigDecimal;
[/if]
[if (hasParameterTypeByName(c, 'DataHandler'))]
import javax.activation.DataHandler;
[/if]
[if (hasParameterTypeByName(c, 'Document'))]
import org.w3c.dom.Document;
[/if]
[if (hasParameterTypeByName(c, 'Timestamp'))]
import java.sql.Timestamp;
[/if]
[if (hasParameterTypeByName(c, 'Calendar'))]
import java.util.Calendar;
[/if]
[if (hasParameterTypeByName(c, 'Date'))]
import java.util.Date;
[/if]
[if (hasParameterTypeByName(c, 'EmptyBean'))]
import gnf.ada.core.service.EmptyBean;
[/if]
[if (hasParameterTypeByName(c, 'Map'))]
import java.util.HashMap;
[/if]
[if (hasParameterList(c) or hasOperationReturnLis(c))]
import java.util.ArrayList;
[/if]
[if (hasSerializable(c))]
import java.io.Serializable;
[/if]
[/template]


And the warning that leaving is:
Invalid result for expression c.ownedOperation->asSequence()->collect(temp2 : Operation | temp2.ownedParameter)->select(p : Parameter | p.type.name.equalsIgnoreCase(parameterName))->size().>(0) at line 57 in Module common for query hasParameterTypeByName(Class,String). Last recorded value of self was org.eclipse.uml2.uml.internal.impl.ClassImpl@179a5d (name: MantPropertyTypeService, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false).

That strategy I can use to eliminate this warnings?

Thank in advance for you reply
Juan Carlos

PD: Repito el post because no aparece el primero.
Re: [Acceleo] eliminate warnings [message #654887 is a reply to message #654814] Thu, 17 February 2011 14:08 Go to previous message
Laurent Goubet is currently offline Laurent Goubet
Messages: 1632
Registered: July 2009
Senior Member
This is a multi-part message in MIME format.
--------------020900030304010106020607
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit

Hi Juan,

This error message means that somewhere in the course of evaluating
"c.ownedOperation->asSequence()->collect(ownedParameter)->select(p :
Parameter | p.type.name.equalsIgnoreCase(parameterName))->size() > 0",
one of the objects was null. So I'd say that you either have a
Collection with a Parameter that doesn't have a type, or a type with no
name (check the class MantPropertyTypeService first as it seem to be the
culprit).

If you open your model, right-click the root and use "validate", do you
get any error reported?

Otherwise, you'll have to manually check that all of your operations
have the right kind of parameters, or defend against the issue within
Acceleo itself :

c.ownedOperation->asSequence()->collect(ownedParameter)->select(p :
> Parameter | if (not (p.type.oclIsUndefined() or
p.type.name.oclIsUndefined())) then
p.type.name.equalsIgnoreCase(parameterName) else false endif)->size() > 0

Laurent Goubet
Obeo

On 17/02/2011 10:45, olafo987 wrote:
> Hello First, I apologize for my poor Inglish.
>
> I'm working at one project with "Acceleo" and I have the need of
> eliminate multiples "warnings" that I have. I have very code as this:
>
> [query public hasParameterTypeByName(c : Class, parameterName : String)
> : Boolean =
> (c.ownedOperation->asSequence()->collect(ownedParameter)->select(p :
> Parameter | p.type.name.equalsIgnoreCase(parameterName))->size() > 0) /]
>
> [template public templateImportsSpecialsParameters(c : Class) post
> (trim())]
> [if (c.hasParameterTypeByName('BigDecimal'))]
> import java.math.BigDecimal;
> [/if]
> [if (hasParameterTypeByName(c, 'DataHandler'))]
> import javax.activation.DataHandler;
> [/if]
> [if (hasParameterTypeByName(c, 'Document'))]
> import org.w3c.dom.Document;
> [/if]
> [if (hasParameterTypeByName(c, 'Timestamp'))]
> import java.sql.Timestamp;
> [/if]
> [if (hasParameterTypeByName(c, 'Calendar'))]
> import java.util.Calendar;
> [/if]
> [if (hasParameterTypeByName(c, 'Date'))]
> import java.util.Date;
> [/if]
> [if (hasParameterTypeByName(c, 'EmptyBean'))]
> import gnf.ada.core.service.EmptyBean;
> [/if]
> [if (hasParameterTypeByName(c, 'Map'))]
> import java.util.HashMap;
> [/if]
> [if (hasParameterList(c) or hasOperationReturnLis(c))]
> import java.util.ArrayList;
> [/if]
> [if (hasSerializable(c))]
> import java.io.Serializable;
> [/if]
> [/template]
>
>
> And the warning that leaving is:
> Invalid result for expression
> c.ownedOperation->asSequence()->collect(temp2 : Operation |
> temp2.ownedParameter)->select(p : Parameter |
> p.type.name.equalsIgnoreCase(parameterName))->size().>(0) at line 57 in
> Module common for query hasParameterTypeByName(Class,String). Last
> recorded value of self was
> mailto:org.eclipse.uml2.uml.internal.impl.ClassImpl@179a5d (name:
> MantPropertyTypeService, visibility: <unset>) (isLeaf: false,
> isAbstract: false) (isActive: false).
>
> That strategy I can use to eliminate this warnings?
>
> Thank in advance for you reply
> Juan Carlos
>
> PD: Repito el post because no aparece el primero.


--------------020900030304010106020607
Content-Type: text/x-vcard; charset=utf-8;
name="laurent_goubet.vcf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="laurent_goubet.vcf"

YmVnaW46dmNhcmQNCmZuOkxhdXJlbnQgR291YmV0DQpuOkdvdWJldDtMYXVy ZW50DQpvcmc6
PGEgaHJlZj0iaHR0cDovL3d3dy5vYmVvLmZyIj5PYmVvPC9hPg0KZW1haWw7 aW50ZXJuZXQ6
bGF1cmVudC5nb3ViZXRAb2Jlby5mcg0KdXJsOmh0dHA6Ly93d3cub2Jlby5m cg0KdmVyc2lv
bjoyLjENCmVuZDp2Y2FyZA0KDQo=
--------------020900030304010106020607--
Previous Topic:[Acceleo 3] Debugging Templates
Next Topic:[acceleo] Source context menu not showing up during Android Tutorial
Goto Forum:
  


Current Time: Fri Oct 31 04:13:30 GMT 2014

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

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