[forge-issues] [JBoss JIRA] (ROASTER-50) Roaster tries to add Generic Type Variable as a java import

Elis Edlund (JIRA) issues at jboss.org
Thu May 19 08:21:00 EDT 2016


    [ https://issues.jboss.org/browse/ROASTER-50?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13239977#comment-13239977 ] 

Elis Edlund commented on ROASTER-50:
------------------------------------

have similar problem but for ReturnType: 
        MethodSource<JavaClassSource> methodSrc; // public <T> SomeClass<T> methodName(T paramName) {}
        MethodSource<JavaClassSource> methodDst; // just an example, I want to create a similar method to above in another generated class.
        
        methodDst.setReturnType(methodSrc.getReturnType()); // Type != JavaType and not castable!
        methodDst.setReturnType(methodSrc.getReturnType().getQualifiedNameWithGenerics()); // -> java.lang.IllegalArgumentException: Cannot import class without a package [T]
        

> Roaster tries to add Generic Type Variable as a java import
> -----------------------------------------------------------
>
>                 Key: ROASTER-50
>                 URL: https://issues.jboss.org/browse/ROASTER-50
>             Project: Roaster
>          Issue Type: Bug
>            Reporter: Yusuf Iskenderoglu
>             Fix For: 2.x Future
>
>
> When you create a new Method with a Type variable, you cannot use it in a parameter, it crashes with:
> {code}
> Exception in thread "main" java.lang.IllegalArgumentException: Cannot import class without a package [T]
> 	at org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:172)
> 	at org.jboss.forge.roaster.model.impl.MethodImpl.addParameter(MethodImpl.java:682)
> 	at de.check24.finance.baufi.roast.main.Roast.parse(Roast.java:225)
> {code}
> This is due to AbstractJavaSource.requiresImport() not returning false for type variables.
> Can you consider this for the next release, too?
> Thanks!
> Related To: ROASTER-48



--
This message was sent by Atlassian JIRA
(v6.4.11#64026)


More information about the forge-issues mailing list