From e972282620bcdbdf76438a83bb05e11f763528da Mon Sep 17 00:00:00 2001 From: JanUlrich Date: Wed, 30 May 2018 16:10:20 +0200 Subject: [PATCH] Generics fix --- .../parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java | 3 +++ .../parser/SyntaxTreeGenerator/TypeGenerator.java | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java index b7f14f19..33ece33e 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/SyntaxTreeGenerator.java @@ -427,6 +427,9 @@ public class SyntaxTreeGenerator{ GenericsRegistry ret = new GenericsRegistry(this.globalGenerics); ret.putAll(generics); 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()){ TypeGenerator.convert(tp, parentClass, parentMethod, reg, ret); } diff --git a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java index 8f997603..1754dde7 100644 --- a/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java +++ b/src/de/dhbwstuttgart/parser/SyntaxTreeGenerator/TypeGenerator.java @@ -59,10 +59,6 @@ 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()){