diff --git a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java index 52921c5d6..bef11e7ca 100644 --- a/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java +++ b/src/de/dhbwstuttgart/syntaxtree/factory/ASTFactory.java @@ -17,6 +17,7 @@ import de.dhbwstuttgart.syntaxtree.type.Void; import de.dhbwstuttgart.syntaxtree.*; import de.dhbwstuttgart.syntaxtree.statement.Block; import de.dhbwstuttgart.syntaxtree.statement.Statement; +import de.dhbwstuttgart.syntaxtree.type.WildcardType; import org.antlr.v4.runtime.Token; /** @@ -201,8 +202,19 @@ public class ASTFactory { //Diese entfernen: name = name.split("<")[0]; } - RefType ret = new RefType(new JavaClassName(name), params, new NullToken()); - return ret; + if(type instanceof java.lang.reflect.WildcardType){ + java.lang.reflect.WildcardType wildcardType = (java.lang.reflect.WildcardType) type; + if(wildcardType.getLowerBounds().length > 0){ + return new SuperWildcardType(convertType(wildcardType.getLowerBounds()[0]), new NullToken()); + }else if(wildcardType.getUpperBounds().length > 0){ + return new ExtendsWildcardType(convertType(wildcardType.getUpperBounds()[0]), new NullToken()); + }else{//Es handelt sich um den '?'-Typ: + return new ExtendsWildcardType(createObjectType(), new NullToken()); + } + }else{ + RefType ret = new RefType(new JavaClassName(name), params, new NullToken()); + return ret; + } } } diff --git a/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java b/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java index d5abd93b8..5f282e467 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/ExtendsWildcardType.java @@ -34,6 +34,10 @@ public class ExtendsWildcardType extends WildcardType{ return false; } + @Override + public String toString() { + return "? extends "+innerType.toString(); + } @Override public void accept(ASTVisitor visitor) { diff --git a/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java b/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java index 740c80e5a..625fb01bd 100644 --- a/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java +++ b/src/de/dhbwstuttgart/syntaxtree/type/SuperWildcardType.java @@ -35,6 +35,11 @@ public class SuperWildcardType extends WildcardType{ return this.innerType; } + @Override + public String toString() { + return "? super "+innerType.toString(); + } + @Override public boolean isExtends() { return false;