modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
klein Korrekturen modified: src/test/java/insertGenerics/TestTwoArgs2.java List -> Set
This commit is contained in:
parent
f5f639c0f7
commit
db149eb588
@ -662,8 +662,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
Iterator<Pair> itUndCons = undCons.iterator();
|
Iterator<Pair> itUndCons = undCons.iterator();
|
||||||
while (itUndCons.hasNext()) {
|
while (itUndCons.hasNext()) {
|
||||||
Pair pairUndCons2 = itUndCons.next();
|
Pair pairUndCons2 = itUndCons.next();
|
||||||
boolean rEqRtilde = (tphR == pairUndCons2.TA1);
|
boolean rEqExRtilde = (tphR == pairUndCons2.TA1);
|
||||||
boolean rExRtilde = (tphR == pairUndCons2.TA1);
|
|
||||||
// Pair rExRtildePair = new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT);
|
// Pair rExRtildePair = new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT);
|
||||||
boolean isPairInTExTapostrophe = false;
|
boolean isPairInTExTapostrophe = false;
|
||||||
// Constraint<Pair> allOfOr = new Constraint<Pair>();
|
// Constraint<Pair> allOfOr = new Constraint<Pair>();
|
||||||
@ -675,14 +674,14 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
while(itCP.hasNext()) {
|
while(itCP.hasNext()) {
|
||||||
Pair p = itCP.next();
|
Pair p = itCP.next();
|
||||||
if(p.OperatorSmallerDot()) {
|
if(p.OperatorSmallerDot()) {
|
||||||
isPairInTExTapostrophe = tphR == p.TA1;
|
isPairInTExTapostrophe = isPairInTExTapostrophe || tphR.equals(p.TA1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (rEqRtilde || rExRtilde || isPairInTExTapostrophe) {
|
if (rEqExRtilde || isPairInTExTapostrophe) {
|
||||||
if (newPair2.TA1 != newPair2.TA2) { //eliminieren der Fälle wie AA<.AA
|
if (newPair2.TA1 != newPair2.TA2) { //eliminieren der Fälle wie AA<.AA
|
||||||
if (!checkForDuplicatesForSets(newPair2, tempSet2))
|
if (!checkForDuplicatesForSets(newPair2, tempSet2))
|
||||||
tempSet2.add(newPair2);
|
tempSet2.add(newPair2);
|
||||||
|
@ -56,15 +56,15 @@ public class TestTwoArgs2 {
|
|||||||
|
|
||||||
List<ClassConstraint> classConstraintsTest = new ArrayList<>();
|
List<ClassConstraint> classConstraintsTest = new ArrayList<>();
|
||||||
classConstraintsTest.add(new ClassConstraint("N", "java/lang/Object", Relation.EXTENDS));
|
classConstraintsTest.add(new ClassConstraint("N", "java/lang/Object", Relation.EXTENDS));
|
||||||
HashMap<String, List<MethodConstraint>> methodConstraintsWithPositionTest = new HashMap<>();
|
HashMap<String, Set<MethodConstraint>> methodConstraintsWithPositionTest = new HashMap<>();
|
||||||
List<MethodConstraint> lmc;
|
Set<MethodConstraint> lmc;
|
||||||
lmc = new ArrayList<>();
|
lmc = new HashSet<>();
|
||||||
lmc.add(new MethodConstraint("AG", "AA", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AG", "AA", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("U", "P", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("U", "P", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("AA", "java/lang/Object", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AA", "java/lang/Object", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH AAm(TPH AATPH U)", lmc);
|
methodConstraintsWithPositionTest.put("TPH AAm(TPH AATPH U)", lmc);
|
||||||
lmc = new ArrayList<>();
|
lmc = new HashSet<>();
|
||||||
lmc.add(new MethodConstraint("AB", "P", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AB", "P", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("AC", "U", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AC", "U", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("AB", "AA", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AB", "AA", Relation.EXTENDS));
|
||||||
@ -73,7 +73,7 @@ public class TestTwoArgs2 {
|
|||||||
lmc.add(new MethodConstraint("U", "AA", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("U", "AA", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH AAmain(TPH ABTPH AC)", lmc);
|
methodConstraintsWithPositionTest.put("TPH AAmain(TPH ABTPH AC)", lmc);
|
||||||
lmc = new ArrayList<>();
|
lmc = new HashSet<>();
|
||||||
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("AG", "java/lang/Object", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("AG", "java/lang/Object", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH AGid(TPH P)", lmc);
|
methodConstraintsWithPositionTest.put("TPH AGid(TPH P)", lmc);
|
||||||
@ -84,7 +84,10 @@ public class TestTwoArgs2 {
|
|||||||
|
|
||||||
assertEquals(expectedClassCons, computedClassCons);
|
assertEquals(expectedClassCons, computedClassCons);
|
||||||
|
|
||||||
assertEquals(methodConstraintsWithPositionTest, fogg.methodConstraintsWithPosition);
|
HashMap<String, Set<MethodConstraint>> methodConstraintsWithPositionComputed = new HashMap<>();
|
||||||
|
fogg.methodConstraintsWithPosition.forEach((s, l) -> methodConstraintsWithPositionComputed.put(s,new HashSet<>(l)));
|
||||||
|
|
||||||
|
assertEquals(methodConstraintsWithPositionTest, methodConstraintsWithPositionComputed);
|
||||||
|
|
||||||
compiler.generateBytecode(new File(pathToClassFile), results, simplifyResultsForAllSourceFiles);
|
compiler.generateBytecode(new File(pathToClassFile), results, simplifyResultsForAllSourceFiles);
|
||||||
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});
|
||||||
|
Loading…
Reference in New Issue
Block a user