forked from JavaTX/JavaCompilerCore
Fix Generics parsing
This commit is contained in:
parent
7a5940ac65
commit
f7160c10f4
@ -59,6 +59,10 @@ 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()){
|
||||||
@ -75,7 +79,6 @@ public class TypeGenerator {
|
|||||||
List<RefTypeOrTPHOrWildcardOrGeneric> bounds = TypeGenerator.convert(typeParameter.typeBound(),reg, generics);
|
List<RefTypeOrTPHOrWildcardOrGeneric> bounds = TypeGenerator.convert(typeParameter.typeBound(),reg, generics);
|
||||||
|
|
||||||
GenericTypeVar ret = new GenericTypeVar(name, bounds, typeParameter.getStart(), typeParameter.getStop());
|
GenericTypeVar ret = new GenericTypeVar(name, bounds, typeParameter.getStart(), typeParameter.getStop());
|
||||||
generics.put(name, new GenericContext(parentClass, parentMethod));
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user