[forge-issues] [JBoss JIRA] (ROASTER-105) addProperty with generic value doesn't transform import

Nicolas Challut (JIRA) issues at jboss.org
Tue Jun 7 09:07:00 EDT 2016


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

Nicolas Challut commented on ROASTER-105:
-----------------------------------------

And finally, If I want to create a class, I use Roaster.format(classSource) and then :

{code:java}
        JavaClassSource source = Roaster.create(JavaClassSource.class);
        source.addProperty("java.util.List<java.lang.String>", "list");
        System.out.println(Roaster.format(source.toString()));
{code}

>>import java.util.List;

public class JavaClass {

	private List<java.lang.String> list;

	public List<String> getList() {
		return list;
	}

	public void setList(List<String> list) {
		this.list = list;
	}
}

> addProperty with generic value doesn't transform import
> -------------------------------------------------------
>
>                 Key: ROASTER-105
>                 URL: https://issues.jboss.org/browse/ROASTER-105
>             Project: Roaster
>          Issue Type: Bug
>            Reporter: Nicolas Challut
>
> {code:java}
>     @Test
>     public void addGenericAndGetPropertyType()
>     {
>         JavaClassSource classSource = Roaster.create(JavaClassSource.class);
>         classSource.addProperty("java.util.List<java.lang.String>", "list");
>         PropertySource<JavaClassSource> property = classSource.getProperty("list");
>         Type<JavaClassSource> propertyType = property.getType();
>         assertEquals("List<String>", propertyType.toString());
>     }
>     @Test
>     public void addGenericAndGetFieldType()
>     {
>         JavaClassSource classSource = Roaster.create(JavaClassSource.class);
>         classSource.addProperty("java.util.List<java.lang.String>", "list");
>         PropertySource<JavaClassSource> property = classSource.getProperty("list");
>         FieldSource<JavaClassSource> field = property.getField();
>         Type<JavaClassSource> fieldType = field.getType();
>         assertEquals("List<String>", fieldType.toString());
>     }
> {code}



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


More information about the forge-issues mailing list