Generics fix

This commit is contained in:
JanUlrich 2018-05-30 16:10:20 +02:00
parent 98eb1827b8
commit 1ca7fba835
2 changed files with 3 additions and 4 deletions

View File

@ -427,6 +427,9 @@ public class SyntaxTreeGenerator{
GenericsRegistry ret = new GenericsRegistry(this.globalGenerics); GenericsRegistry ret = new GenericsRegistry(this.globalGenerics);
ret.putAll(generics); ret.putAll(generics);
if(ctx == null || ctx.typeParameterList() == null)return ret; if(ctx == null || ctx.typeParameterList() == null)return ret;
for(Java8Parser.TypeParameterContext tp : ctx.typeParameterList().typeParameter()){
ret.put(tp.Identifier().getText(), new GenericContext(parentClass, parentMethod));
}
for(Java8Parser.TypeParameterContext tp : ctx.typeParameterList().typeParameter()){ for(Java8Parser.TypeParameterContext tp : ctx.typeParameterList().typeParameter()){
TypeGenerator.convert(tp, parentClass, parentMethod, reg, ret); TypeGenerator.convert(tp, parentClass, parentMethod, reg, ret);
} }

View File

@ -61,10 +61,6 @@ public class TypeGenerator {
public static GenericDeclarationList convert(Java8Parser.TypeParametersContext typeParametersContext, public static GenericDeclarationList convert(Java8Parser.TypeParametersContext typeParametersContext,
JavaClassName parentClass, String parentMethod, JavaClassRegistry reg, GenericsRegistry generics) { 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(); Token endOffset = typeParametersContext.getStop();
List<GenericTypeVar> typeVars = new ArrayList<>(); List<GenericTypeVar> typeVars = new ArrayList<>();
for(Java8Parser.TypeParameterContext typeParameter : typeParametersContext.typeParameterList().typeParameter()){ for(Java8Parser.TypeParameterContext typeParameter : typeParametersContext.typeParameterList().typeParameter()){