forked from JavaTX/JavaCompilerCore
add replacement of param types with tph and generate consolidated
constraints
This commit is contained in:
parent
b59aabeea5
commit
98b3ad1517
@ -1,7 +1,7 @@
|
|||||||
package de.dhbwstuttgart.inferWildcards;
|
package de.dhbwstuttgart.inferWildcards;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.ListIterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import de.dhbwstuttgart.parser.NullToken;
|
import de.dhbwstuttgart.parser.NullToken;
|
||||||
@ -24,10 +24,18 @@ public class ReplaceTypeparamVisitor
|
|||||||
public void visit (RefType refType) {
|
public void visit (RefType refType) {
|
||||||
if (!refType.getParaList().isEmpty()) {
|
if (!refType.getParaList().isEmpty()) {
|
||||||
System.out.println("Type: " + refType);
|
System.out.println("Type: " + refType);
|
||||||
List<RefTypeOrTPHOrWildcardOrGeneric> paraList = refType.getParaList();
|
|
||||||
paraList.stream().filter(e -> e instanceof RefType).map(RefType.class::cast)
|
|
||||||
.forEach(this::generateTypePlaceholder);
|
|
||||||
|
|
||||||
|
for (ListIterator<RefTypeOrTPHOrWildcardOrGeneric> listIterator = refType.getParaList()
|
||||||
|
.listIterator(); listIterator
|
||||||
|
.hasNext();) {
|
||||||
|
RefTypeOrTPHOrWildcardOrGeneric next = listIterator.next();
|
||||||
|
|
||||||
|
if (next instanceof RefType) {
|
||||||
|
RefType nextRefType = (RefType) next;
|
||||||
|
TypePlaceholder tph = generateTypePlaceholder(nextRefType);
|
||||||
|
listIterator.set(tph);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
super.visit(refType);
|
super.visit(refType);
|
||||||
}
|
}
|
||||||
|
@ -52,8 +52,9 @@ public class TestInferWildcardsJavaTx
|
|||||||
|
|
||||||
// Constraints
|
// Constraints
|
||||||
ConstraintSet<Pair> constraints = javaTXCompiler.getConstraints();
|
ConstraintSet<Pair> constraints = javaTXCompiler.getConstraints();
|
||||||
|
constraints.addAll(generatedConstraints);
|
||||||
|
|
||||||
// System.out.println(constraints);
|
System.out.println(constraints);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user