[
https://issues.jboss.org/browse/ROASTER-117?page=com.atlassian.jira.plugi...
]
Kai Müller updated ROASTER-117:
-------------------------------
Comment: was deleted
(was: Hi,
it seems this is an issue with your test program. You executing the split on the first
generic part, which is "java.util.Map<String,SomeOtherClass>". If you
then execute a split on this and try to convert it to a simple type, which is
"java.util.Map<String" --> that's no valid java.
Your program can be fixed, by adding another getGenericsTypeParameter and using the new
value in the for loop:
{code:java}
String type =
"SomeClass<java.util.Map<String,SomeOtherClass>>";
String typeD = Types.stripGenerics(type);
String simpleTypeDName = Types.toSimpleName(typeD);
String typesGeneric = Types.getGenericsTypeParameter(type);
String typesGenericMap = Types.getGenericsTypeParameter(typesGeneric);
for (String typeP : typesGenericMap.split(","))
{
System.out.println(typeP);
Types.toSimpleName(typeP.trim());
}
{code}
Best regards,
Kai
)
Cannot set supertype with nested generics
-----------------------------------------
Key: ROASTER-117
URL:
https://issues.jboss.org/browse/ROASTER-117
Project: Roaster
Issue Type: Bug
Components: JDT
Affects Versions: 2.19.4.Final
Reporter: Stefan Brötz
Priority: Major
Calling
javaClassSource.setSuperType("SomeClass<java.util.Map<String,SomeOtherClass>>")
throws a java.lang.StringIndexOutOfBoundsException:
java.lang.StringIndexOutOfBoundsException: String index out of range: -15
at java.lang.String.substring(String.java:1967)
at org.jboss.forge.roaster.model.util.Types.isGeneric(Types.java:317)
at org.jboss.forge.roaster.model.util.Types.toSimpleName(Types.java:192)
at myTest(...)
--
This message was sent by Atlassian Jira
(v7.12.1#712002)