[PLUGIN]: Filter type insert points after insertion.

This commit is contained in:
Michael Uhl 2019-04-18 09:42:34 +02:00
parent e53c29f582
commit 905d9e25a2
5 changed files with 502 additions and 429 deletions

View File

@ -1,73 +1,73 @@
package de.dhbwstuttgart.typedeployment; package de.dhbwstuttgart.typedeployment;
import de.dhbwstuttgart.exceptions.NotImplementedException; import de.dhbwstuttgart.exceptions.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.*; import de.dhbwstuttgart.syntaxtree.*;
import de.dhbwstuttgart.syntaxtree.statement.JavaInternalExpression; import de.dhbwstuttgart.syntaxtree.statement.JavaInternalExpression;
import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression; import de.dhbwstuttgart.syntaxtree.statement.LambdaExpression;
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder; import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
import de.dhbwstuttgart.typeinference.result.ResultSet; import de.dhbwstuttgart.typeinference.result.ResultSet;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
public class TypeInsertPlacer extends AbstractASTWalker{ public class TypeInsertPlacer extends AbstractASTWalker{
Set<TypeInsert> inserts = new HashSet<>(); Set<TypeInsert> inserts = new HashSet<>();
private ResultSet withResults; private ResultSet withResults;
public Set<TypeInsert> getTypeInserts(SourceFile forSourceFile, ResultSet withResults){ public Set<TypeInsert> getTypeInserts(SourceFile forSourceFile, ResultSet withResults){
this.withResults = withResults; this.withResults = withResults;
forSourceFile.accept(this); forSourceFile.accept(this);
return inserts; return inserts;
} }
@Override @Override
public void visit(ClassOrInterface classOrInterface) { public void visit(ClassOrInterface classOrInterface) {
TypeInsertPlacerClass cl = new TypeInsertPlacerClass(classOrInterface, withResults); TypeInsertPlacerClass cl = new TypeInsertPlacerClass(classOrInterface, withResults);
this.inserts.addAll(cl.inserts); this.inserts.addAll(cl.inserts);
} }
} }
class TypeInsertPlacerClass extends AbstractASTWalker{ class TypeInsertPlacerClass extends AbstractASTWalker{
protected final ResultSet results; protected final ResultSet results;
protected final ClassOrInterface cl; protected final ClassOrInterface cl;
public final Set<TypeInsert> inserts = new HashSet<>(); public final Set<TypeInsert> inserts = new HashSet<>();
private Method method; private Method method;
TypeInsertPlacerClass(ClassOrInterface forClass, ResultSet withResults){ TypeInsertPlacerClass(ClassOrInterface forClass, ResultSet withResults){
this.cl = forClass; this.cl = forClass;
this.method = null; this.method = null;
this.results = withResults; this.results = withResults;
forClass.accept(this); forClass.accept(this);
} }
@Override @Override
public void visit(Method method) { public void visit(Method method) {
this.method = method; this.method = method;
if(method.getReturnType() instanceof TypePlaceholder) if(method.getReturnType() instanceof TypePlaceholder)
inserts.add(TypeInsertFactory.createInsertPoints( inserts.add(TypeInsertFactory.createInsertPoints(
method.getReturnType(), method.getReturnType().getOffset(), cl, method, results)); method.getReturnType(), method.getReturnType().getOffset(), cl, method, results));
super.visit(method); super.visit(method);
} }
@Override @Override
public void visit(Field field) { public void visit(Field field) {
if(field.getType() instanceof TypePlaceholder){ if(field.getType() instanceof TypePlaceholder){
inserts.add(TypeInsertFactory.createInsertPoints( inserts.add(TypeInsertFactory.createInsertPoints(
field.getType(), field.getType().getOffset(), cl, method, results)); field.getType(), field.getType().getOffset(), cl, method, results));
} }
super.visit(field); super.visit(field);
} }
@Override @Override
public void visit(FormalParameter param) { public void visit(FormalParameter param) {
if(param.getType() instanceof TypePlaceholder) if(param.getType() instanceof TypePlaceholder)
inserts.add(TypeInsertFactory.createInsertPoints( inserts.add(TypeInsertFactory.createInsertPoints(
param.getType(), param.getType().getOffset(), cl, method, results)); param.getType(), param.getType().getOffset(), cl, method, results));
super.visit(param); super.visit(param);
} }
@Override @Override
public void visit(LambdaExpression lambdaExpression) { public void visit(LambdaExpression lambdaExpression) {
//Lambda-Ausdrücke brauchen keine Typeinsetzungen //Lambda-Ausdrücke brauchen keine Typeinsetzungen
} }
} }

View File

@ -1,57 +1,54 @@
package de.dhbwstuttgart.typedeployment; package de.dhbwstuttgart.typedeployment;
import org.antlr.v4.runtime.Token; import org.antlr.v4.runtime.Token;
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType; import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
import java.util.List; import java.util.List;
import java.util.stream.Collectors; import java.util.stream.Collectors;
public class TypeInsertPoint { public class TypeInsertPoint {
public Token point; public Token point;
private String insertString; private String insertString;
private int extraOffset = 0;
public TypeInsertPoint(Token point, String toInsert){
this.point = point; public TypeInsertPoint(Token point, String toInsert){
this.insertString = (toInsert.endsWith(" ")) ? toInsert : toInsert + " " ; this.point = point;
} this.insertString = (toInsert.endsWith(" ")) ? toInsert : toInsert + " " ;
}
public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
int offset = additionalOffset.stream().filter((token -> public String insert(String intoSource, List<TypeInsertPoint> additionalOffset){
//token.point.getLine() != point.getLine() && token.point.getCharPositionInLine() <= point.getCharPositionInLine())) int offset = additionalOffset.stream().filter((token ->
token.point.getStartIndex() <= point.getStartIndex())) //token.point.getLine() != point.getLine() && token.point.getCharPositionInLine() <= point.getCharPositionInLine()))
.mapToInt((typeInsertPoint -> typeInsertPoint.insertString.length())).sum(); token.point.getStartIndex() <= point.getStartIndex()))
return new StringBuilder(intoSource).insert(point.getStartIndex()+offset, insertString).toString(); .mapToInt((typeInsertPoint -> typeInsertPoint.insertString.length())).sum();
} return new StringBuilder(intoSource).insert(point.getStartIndex()+offset+extraOffset, insertString).toString();
}
public String getInsertString() {
return insertString; public String getInsertString() {
} return insertString;
}
public Token getToken() {
return this.point; public void addExtraOffset(int toAdd) {
} this.extraOffset += toAdd;
}
public void setToken(Token point) {
this.point = point; /* PL 2018-06-19
} * Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind
* eingefuegt damit man TypeReplaceMarker vergleichen kann
/* PL 2018-06-19 * @see java.lang.Object#equals(java.lang.Object)
* Zwei TypeInsertPoint's sind gleich, wenn ihre point's gleich sind */
* eingefuegt damit man TypeReplaceMarker vergleichen kann public boolean equals(Object obj) {
* @see java.lang.Object#equals(java.lang.Object) if(!(obj instanceof TypeInsertPoint)) {
*/ return false;
public boolean equals(Object obj) { }
if(!(obj instanceof TypeInsertPoint)) { else {
return false; return ((TypeInsertPoint)obj).point.equals(this.point) &&
} ((TypeInsertPoint)obj).insertString.equals(this.insertString);
else { }
return ((TypeInsertPoint)obj).point.equals(this.point) && }
((TypeInsertPoint)obj).insertString.equals(this.insertString);
} public String toString() {
} return point.toString() + " " + insertString.toString();
}
public String toString() { }
return point.toString() + " " + insertString.toString();
}
}

View File

@ -1,30 +1,62 @@
package de.dhbwstuttgart.typeinference.result; package de.dhbwstuttgart.typeinference.result;
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric; import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
/** /**
* Paare, welche das Unifikationsergebnis darstellen * Paare, welche das Unifikationsergebnis darstellen
*/ */
public abstract class ResultPair<A extends RefTypeOrTPHOrWildcardOrGeneric,B extends RefTypeOrTPHOrWildcardOrGeneric> { public abstract class ResultPair<A extends RefTypeOrTPHOrWildcardOrGeneric,B extends RefTypeOrTPHOrWildcardOrGeneric> {
private final A left; private final A left;
private final B right; private final B right;
public abstract void accept(ResultPairVisitor visitor); public abstract void accept(ResultPairVisitor visitor);
public ResultPair(A left, B right){ public ResultPair(A left, B right){
this.left = left; this.left = left;
this.right = right; this.right = right;
} }
public A getLeft() { public A getLeft() {
return left; return left;
} }
public B getRight() { public B getRight() {
return right; return right;
} }
public String toString() { public String toString() {
return "(" + left.toString() + ", " + right.toString() + ")"; return "(" + left.toString() + ", " + right.toString() + ")";
} }
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((left == null) ? 0 : left.getOffset().hashCode());
result = prime * result + ((right == null) ? 0 : right.getOffset().hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
ResultPair<?,?> other = (ResultPair<?,?>) obj;
if (left == null) {
if (other.left != null)
return false;
} else if (!left.getOffset().equals(other.left.getOffset()))
return false;
if (right == null) {
if (other.right != null)
return false;
} else if (!right.getOffset().equals(other.right.getOffset()))
return false;
return true;
}
}

View File

@ -0,0 +1,25 @@
package de.dhbwstuttgart.typeinference.result;
import java.util.HashMap;
import java.util.Map;
import org.antlr.v4.runtime.Token;
public class ResultPairMap {
private Map<Token, ResultPair<?,?>> indexMap = new HashMap<>();
public static final ResultPairMap RESULT_PAIRS = new ResultPairMap();
private ResultPairMap() {
// Nothing to do here.
}
public void put(Token tkn, ResultPair<?, ?> resultPair) {
indexMap.put(tkn, resultPair);
}
public ResultPair<?,?> get(Token tkn) {
return indexMap.get(tkn);
}
}

View File

@ -1,270 +1,289 @@
package de.dhbwstuttgart.typeinference.result; package de.dhbwstuttgart.typeinference.result;
import de.dhbwstuttgart.exceptions.NotImplementedException; import java.util.HashSet;
import de.dhbwstuttgart.syntaxtree.GenericTypeVar; import java.util.Set;
import de.dhbwstuttgart.syntaxtree.type.*;
import de.dhbwstuttgart.exceptions.NotImplementedException;
import java.util.HashSet; import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import java.util.Set; import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
public class ResultSet { import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
public final Set<ResultPair> results; import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
public ResultSet(Set<ResultPair> results){ import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
this.results = results;
} import static de.dhbwstuttgart.typeinference.result.ResultPairMap.RESULT_PAIRS;
public ResolvedType resolveType(RefTypeOrTPHOrWildcardOrGeneric type) { @SuppressWarnings("rawtypes")
if(type instanceof TypePlaceholder) public class ResultSet {
return new Resolver(this).resolve((TypePlaceholder)type); public final Set<ResultPair> results;
if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>()); public ResultSet(Set<ResultPair> set){
if(type instanceof RefType){ this.results = set;
RelatedTypeWalker related = new RelatedTypeWalker(null, this); }
type.accept(related);
return new ResolvedType(type, related.relatedTPHs); public boolean contains(ResultPair toCheck) {
}else{ return this.results.contains(toCheck);
throw new NotImplementedException(); }
//return new ResolvedType(type,new HashSet<>());
} public void remove(ResultPair toCheck) {
} results.remove(toCheck);
}
//TODO Beim Einsetzen eines Generics, müssen die new und Methodenaufrufe verändert werden
public ResolvedType resolveType(RefTypeOrTPHOrWildcardOrGeneric type) {
public String toString() { if(type instanceof TypePlaceholder)
return results.toString(); return new Resolver(this).resolve((TypePlaceholder)type);
} if(type instanceof GenericRefType)return new ResolvedType(type, new HashSet<>());
if(type instanceof RefType){
} RelatedTypeWalker related = new RelatedTypeWalker(null, this);
type.accept(related);
class Resolver implements ResultSetVisitor { return new ResolvedType(type, related.relatedTPHs);
private final ResultSet result; }else{
private TypePlaceholder toResolve; throw new NotImplementedException();
private RefTypeOrTPHOrWildcardOrGeneric resolved; //return new ResolvedType(type,new HashSet<>());
private final Set<GenericInsertPair> additionalTPHs = new HashSet<>(); }
}
public Resolver(ResultSet resultPairs){
this.result = resultPairs; //TODO Beim Einsetzen eines Generics, müssen die new und Methodenaufrufe verändert werden
}
public String toString() {
public ResolvedType resolve(TypePlaceholder tph){ return results.toString();
toResolve = tph; }
resolved = null;
System.out.println(tph.toString()); }
for(ResultPair resultPair : result.results){
if(resultPair instanceof PairTPHEqualTPH && ((PairTPHEqualTPH) resultPair).getLeft().equals(toResolve)){ class Resolver implements ResultSetVisitor {
return resolve(((PairTPHEqualTPH) resultPair).getRight()); private final ResultSet result;
} private TypePlaceholder toResolve;
} private RefTypeOrTPHOrWildcardOrGeneric resolved;
for(ResultPair resultPair : result.results){ private final Set<GenericInsertPair> additionalTPHs = new HashSet<>();
resultPair.accept(this);
} public Resolver(ResultSet resultPairs){
if(resolved==null){//TPH kommt nicht im Result vor: this.result = resultPairs;
resolved = tph; }
}
public ResolvedType resolve(TypePlaceholder tph){
return new ResolvedType(resolved, additionalTPHs);//resolved; toResolve = tph;
} resolved = null;
System.out.println(tph.toString());
@Override for(ResultPair<?,?> resultPair : result.results) {
public void visit(PairTPHsmallerTPH p) { RESULT_PAIRS.put(resultPair.getRight().getOffset(), resultPair);
if(p.left.equals(toResolve)){ RESULT_PAIRS.put(resultPair.getLeft().getOffset(), resultPair);
additionalTPHs.add(new GenericInsertPair(p.left, p.right)); if(resultPair instanceof PairTPHEqualTPH && ((PairTPHEqualTPH) resultPair).getLeft().equals(toResolve)){
additionalTPHs.addAll(new RelatedTypeWalker(p.right, result).relatedTPHs); return resolve(((PairTPHEqualTPH) resultPair).getRight());
} }
if(p.right.equals(toResolve)) }
additionalTPHs.addAll(new RelatedTypeWalker(p.left, result).relatedTPHs); for(ResultPair<?,?> resultPair : result.results){
} resultPair.accept(this);
}
@Override if(resolved==null){//TPH kommt nicht im Result vor:
public void visit(PairTPHequalRefTypeOrWildcardType p) { resolved = tph;
if(p.left.equals(toResolve)){ }
resolved = p.right;
RelatedTypeWalker related = new RelatedTypeWalker(null, result); return new ResolvedType(resolved, additionalTPHs);//resolved;
p.right.accept(related); }
additionalTPHs.addAll(related.relatedTPHs);
} @Override
} public void visit(PairTPHsmallerTPH p) {
if(p.left.equals(toResolve)){
@Override additionalTPHs.add(new GenericInsertPair(p.left, p.right));
public void visit(PairTPHEqualTPH p) { additionalTPHs.addAll(new RelatedTypeWalker(p.right, result).relatedTPHs);
//Do nothing. Dieser Fall wird in der resolve-Methode abgefangen }
} if(p.right.equals(toResolve))
additionalTPHs.addAll(new RelatedTypeWalker(p.left, result).relatedTPHs);
@Override }
public void visit(RefType refType) {
@Override
} public void visit(PairTPHequalRefTypeOrWildcardType p) {
if(p.left.equals(toResolve)){
@Override resolved = p.right;
public void visit(GenericRefType genericRefType) { RelatedTypeWalker related = new RelatedTypeWalker(null, result);
p.right.accept(related);
} additionalTPHs.addAll(related.relatedTPHs);
}
@Override }
public void visit(SuperWildcardType superWildcardType) {
@Override
} public void visit(PairTPHEqualTPH p) {
//Do nothing. Dieser Fall wird in der resolve-Methode abgefangen
@Override }
public void visit(TypePlaceholder typePlaceholder) {
@Override
} public void visit(RefType refType) {
@Override }
public void visit(ExtendsWildcardType extendsWildcardType) {
@Override
} public void visit(GenericRefType genericRefType) {
}
} @Override
public void visit(SuperWildcardType superWildcardType) {
/**
* Sucht aus dem Result Set den Sub/supertyp für einen TPH }
*/
class TPHResolver implements ResultSetVisitor { @Override
public void visit(TypePlaceholder typePlaceholder) {
private final TypePlaceholder tph;
Set<GenericInsertPair> resolved = new HashSet<>(); }
private final ResultSet resultSet;
@Override
TPHResolver(TypePlaceholder tph, ResultSet resultSet){ public void visit(ExtendsWildcardType extendsWildcardType) {
this.resultSet = resultSet;
this.tph = tph; }
for(ResultPair p : resultSet.results){
p.accept(this);
}
if(resolved.size() == 0){ }
resolved.add(new GenericInsertPair(tph, null));
} /**
} * Sucht aus dem Result Set den Sub/supertyp für einen TPH
*/
@Override @SuppressWarnings("rawtypes")
public void visit(PairTPHsmallerTPH p) { class TPHResolver implements ResultSetVisitor {
if(p.left.equals(tph) || p.right.equals(tph)){
resolved.add(new GenericInsertPair(p.left, p.right)); private final TypePlaceholder tph;
} Set<GenericInsertPair> resolved = new HashSet<>();
} private final ResultSet resultSet;
@Override TPHResolver(TypePlaceholder tph, ResultSet resultSet){
public void visit(PairTPHequalRefTypeOrWildcardType p) { this.resultSet = resultSet;
TypePlaceholder otherSide = null; this.tph = tph;
if(p.right.equals(tph)){ for(ResultPair p : resultSet.results){
otherSide = p.left; p.accept(this);
} }
if(otherSide != null){ if(resolved.size() == 0){
Set<ResultPair> newResultSet = new HashSet<>(this.resultSet.results); resolved.add(new GenericInsertPair(tph, null));
newResultSet.remove(p); }
resolved.addAll(new TPHResolver(otherSide, new ResultSet(newResultSet)).resolved); }
}
} @Override
public void visit(PairTPHsmallerTPH p) {
@Override if(p.left.equals(tph) || p.right.equals(tph)){
public void visit(PairTPHEqualTPH p) { resolved.add(new GenericInsertPair(p.left, p.right));
//ignorieren. Wird vom Resolver behandelt }
} }
@Override @Override
public void visit(RefType refType) { public void visit(PairTPHequalRefTypeOrWildcardType p) {
TypePlaceholder otherSide = null;
} if(p.right.equals(tph)){
otherSide = p.left;
@Override }
public void visit(GenericRefType genericRefType) { if(otherSide != null){
Set<ResultPair> newResultSet = new HashSet<>(this.resultSet.results);
} newResultSet.remove(p);
resolved.addAll(new TPHResolver(otherSide, new ResultSet(newResultSet)).resolved);
@Override }
public void visit(SuperWildcardType superWildcardType) { }
} @Override
public void visit(PairTPHEqualTPH p) {
@Override //ignorieren. Wird vom Resolver behandelt
public void visit(TypePlaceholder typePlaceholder) { }
} @Override
public void visit(RefType refType) {
@Override
public void visit(ExtendsWildcardType extendsWildcardType) { }
} @Override
} public void visit(GenericRefType genericRefType) {
class RelatedTypeWalker implements ResultSetVisitor { }
final Set<GenericInsertPair> relatedTPHs = new HashSet<>(); @Override
private final TypePlaceholder toResolve; public void visit(SuperWildcardType superWildcardType) {
private final ResultSet resultSet;
}
/**
* Läuft über das resultSet und speichert alle TPHs, welche mit start in Verbindung stehen @Override
* @param start - kann null sein, wenn der Walker für einen RefType benutzt wird public void visit(TypePlaceholder typePlaceholder) {
* @param resultSet
*/ }
RelatedTypeWalker(TypePlaceholder start, ResultSet resultSet){
this.toResolve = start; @Override
this.resultSet = resultSet; public void visit(ExtendsWildcardType extendsWildcardType) {
int resolved = 0;
do{ }
resolved = relatedTPHs.size(); }
for(ResultPair p : resultSet.results){
p.accept(this); @SuppressWarnings("rawtypes")
p.accept(this); class RelatedTypeWalker implements ResultSetVisitor {
}
}while(resolved - relatedTPHs.size() > 0); final Set<GenericInsertPair> relatedTPHs = new HashSet<>();
} private final TypePlaceholder toResolve;
private final ResultSet resultSet;
@Override
public void visit(PairTPHsmallerTPH p) { /**
if(p.getRight().equals(toResolve)){ * Läuft über das resultSet und speichert alle TPHs, welche mit start in Verbindung stehen
relatedTPHs.addAll(new TPHResolver(p.right, resultSet).resolved); * @param start - kann null sein, wenn der Walker für einen RefType benutzt wird
//relatedTPHs.addAll(new RelatedTypeWalker(p.right, resultSet).relatedTPHs); * @param resultSet
} */
if(p.getLeft().equals(toResolve)){ RelatedTypeWalker(TypePlaceholder start, ResultSet resultSet){
relatedTPHs.addAll(new TPHResolver(p.left, resultSet).resolved); this.toResolve = start;
//relatedTPHs.addAll(new RelatedTypeWalker(p.left, resultSet).relatedTPHs); this.resultSet = resultSet;
} int resolved = 0;
} do{
resolved = relatedTPHs.size();
@Override for(ResultPair p : resultSet.results){
public void visit(PairTPHequalRefTypeOrWildcardType p) { p.accept(this);
if(p.getLeft().equals(toResolve)){ p.accept(this);
p.getRight().accept(this); }
} }while(resolved - relatedTPHs.size() > 0);
} }
@Override @Override
public void visit(PairTPHEqualTPH p) { public void visit(PairTPHsmallerTPH p) {
//Kann ignoriert werden. Diese Fälle werden vom Resolver behandelt if(p.getRight().equals(toResolve)){
} relatedTPHs.addAll(new TPHResolver(p.right, resultSet).resolved);
//relatedTPHs.addAll(new RelatedTypeWalker(p.right, resultSet).relatedTPHs);
/* }
Die folgenden Funktionen fügen alle TPHs an die relatedTPHs an, denen sie begegnen: if(p.getLeft().equals(toResolve)){
Das wird verwendet, wenn alle relatedTPHs aus den Parametern eines RefTypes angefügt werden sollen relatedTPHs.addAll(new TPHResolver(p.left, resultSet).resolved);
*/ //relatedTPHs.addAll(new RelatedTypeWalker(p.left, resultSet).relatedTPHs);
}
@Override }
public void visit(RefType refType) {
for(RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()){ @Override
param.accept(this); public void visit(PairTPHequalRefTypeOrWildcardType p) {
} if(p.getLeft().equals(toResolve)){
} p.getRight().accept(this);
}
@Override }
public void visit(SuperWildcardType superWildcardType) {
superWildcardType.getInnerType().accept(this); @Override
} public void visit(PairTPHEqualTPH p) {
//Kann ignoriert werden. Diese Fälle werden vom Resolver behandelt
@Override }
public void visit(TypePlaceholder typePlaceholder) {
relatedTPHs.addAll(new TPHResolver(typePlaceholder, resultSet).resolved); /*
} Die folgenden Funktionen fügen alle TPHs an die relatedTPHs an, denen sie begegnen:
Das wird verwendet, wenn alle relatedTPHs aus den Parametern eines RefTypes angefügt werden sollen
@Override */
public void visit(ExtendsWildcardType extendsWildcardType) {
extendsWildcardType.getInnerType().accept(this); @Override
} public void visit(RefType refType) {
for(RefTypeOrTPHOrWildcardOrGeneric param : refType.getParaList()){
@Override param.accept(this);
public void visit(GenericRefType genericRefType) { }
} }
@Override
public void visit(SuperWildcardType superWildcardType) {
superWildcardType.getInnerType().accept(this);
}
@Override
public void visit(TypePlaceholder typePlaceholder) {
relatedTPHs.addAll(new TPHResolver(typePlaceholder, resultSet).resolved);
}
@Override
public void visit(ExtendsWildcardType extendsWildcardType) {
extendsWildcardType.getInnerType().accept(this);
}
@Override
public void visit(GenericRefType genericRefType) {
}
} }