]
George Gastaldi closed ROASTER-111.
-----------------------------------
Fix Version/s: 2.19.1.Final
Resolution: Done
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
Fix For: 2.19.1.Final
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}