[forge-issues] [JBoss JIRA] (ROASTER-111) Spaces in generic types in ExtendableSource.setSuperType causes exception

Steven Paligo (JIRA) issues at jboss.org
Thu Sep 22 22:30:00 EDT 2016


Steven Paligo created ROASTER-111:
-------------------------------------

             Summary: Spaces in generic types in ExtendableSource.setSuperType causes exception
                 Key: ROASTER-111
                 URL: https://issues.jboss.org/browse/ROASTER-111
             Project: Roaster
          Issue Type: Bug
          Components: API, Formatter
    Affects Versions: 2.19.0.Final
            Reporter: Steven Paligo


Having a space in the generics of a super type causes an IllegalArgumentException. This is similar to ROASTER-107, but apparently that fix didn't correct this issue.

Code to reproduce:
{code:java}
final JavaClassSource myClass = Roaster.create(JavaClassSource.class);
myClass.setPackage("test");
myClass.setPublic()
    .setName("MyClass")
    .setSuperType("test.MyClassParent<java.util.String, java.util.Object>");
{code}

Exception:

{noformat}
Exception in thread "main" java.lang.IllegalArgumentException: Invalid identifier : > java<
    at org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.SimpleName.setIdentifier(SimpleName.java:195)
    at org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.AST.newSimpleName(AST.java:2202)
    at org.jboss.forge.roaster._shade.org.eclipse.jdt.core.dom.AST.newName(AST.java:1965)
    at org.jboss.forge.roaster.model.impl.ImportImpl.setName(ImportImpl.java:65)
    at org.jboss.forge.roaster.model.impl.AbstractJavaSource.addImport(AbstractJavaSource.java:186)
    at org.jboss.forge.roaster.model.impl.JavaClassImpl.setSuperType(JavaClassImpl.java:190)
    at org.jboss.forge.roaster.model.impl.JavaClassImpl.setSuperType(JavaClassImpl.java:30)
    ...
{noformat}




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


More information about the forge-issues mailing list