From f7160c10f4ab4e3dff6e9e1414949f95ef81ca2a Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 30 May 2018 15:57:51 +0200 Subject: [PATCH] Fix Generics parsing --- .../parser/SyntaxTreeGenerator/TypeGenerator.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java index 03e21d6f..8f997603 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java @@ -59,6 +59,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 typeVars = new ArrayList<>(); for(Java8Parser.TypeParameterContext typeParameter : typeParametersContext.typeParameterList().typeParameter()){ @@ -75,7 +79,6 @@ public class TypeGenerator { List 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; }