Fix Generics parsing

This commit is contained in:
JanUlrich 2018-05-30 15:57:51 +02:00
parent ee1fa17aba
commit 98eb1827b8

View File

@ -61,6 +61,10 @@ public class TypeGenerator {
public static GenericDeclarationList convert(Java8Parser.TypeParametersContext typeParametersContext,
JavaClassName parentClass, String parentMethod, JavaClassRegistry reg, GenericsRegistry generics) {
for(Java8Parser.TypeParameterContext tp : typeParametersContext.typeParameterList().typeParameter()){
generics.put(tp.Identifier().getText(), new GenericContext(parentClass, parentMethod));
}
Token endOffset = typeParametersContext.getStop();
List<GenericTypeVar> typeVars = new ArrayList<>();
for(Java8Parser.TypeParameterContext typeParameter : typeParametersContext.typeParameterList().typeParameter()){
@ -77,7 +81,6 @@ public class TypeGenerator {
List<RefTypeOrTPHOrWildcardOrGeneric> bounds = TypeGenerator.convert(typeParameter.typeBound(),reg, generics);
GenericTypeVar ret = new GenericTypeVar(name, bounds, typeParameter.getStart(), typeParameter.getStop());
generics.put(name, new GenericContext(parentClass, parentMethod));
return ret;
}