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:
pl@gohorb.ba-horb.de 2021-03-26 16:15:18 +01:00
parent f5f639c0f7
commit db149eb588
2 changed files with 12 additions and 10 deletions

View File

@ -662,8 +662,7 @@ public class FamilyOfGeneratedGenerics {
Iterator<Pair> itUndCons = undCons.iterator();
while (itUndCons.hasNext()) {
Pair pairUndCons2 = itUndCons.next();
boolean rEqRtilde = (tphR == pairUndCons2.TA1);
boolean rExRtilde = (tphR == pairUndCons2.TA1);
boolean rEqExRtilde = (tphR == pairUndCons2.TA1);
// Pair rExRtildePair = new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT);
boolean isPairInTExTapostrophe = false;
// Constraint<Pair> allOfOr = new Constraint<Pair>();
@ -675,14 +674,14 @@ public class FamilyOfGeneratedGenerics {
while(itCP.hasNext()) {
Pair p = itCP.next();
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 (!checkForDuplicatesForSets(newPair2, tempSet2))
tempSet2.add(newPair2);

View File

@ -56,15 +56,15 @@ public class TestTwoArgs2 {
List<ClassConstraint> classConstraintsTest = new ArrayList<>();
classConstraintsTest.add(new ClassConstraint("N", "java/lang/Object", Relation.EXTENDS));
HashMap<String, List<MethodConstraint>> methodConstraintsWithPositionTest = new HashMap<>();
List<MethodConstraint> lmc;
lmc = new ArrayList<>();
HashMap<String, Set<MethodConstraint>> methodConstraintsWithPositionTest = new HashMap<>();
Set<MethodConstraint> lmc;
lmc = new HashSet<>();
lmc.add(new MethodConstraint("AG", "AA", Relation.EXTENDS));
lmc.add(new MethodConstraint("U", "P", Relation.EXTENDS));
lmc.add(new MethodConstraint("P", "AG", Relation.EXTENDS));
lmc.add(new MethodConstraint("AA", "java/lang/Object", Relation.EXTENDS));
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("AC", "U", 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("P", "AG", Relation.EXTENDS));
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("AG", "java/lang/Object", Relation.EXTENDS));
methodConstraintsWithPositionTest.put("TPH AGid(TPH P)", lmc);
@ -84,7 +84,10 @@ public class TestTwoArgs2 {
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);
loader = new URLClassLoader(new URL[] {new URL("file://"+pathToClassFile)});