forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
modified: src/test/java/insertGenerics/TestTwoCalls.java
This commit is contained in:
parent
d276c7c044
commit
e3625cb306
@ -518,6 +518,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
Set<Pair> tcOfoldConsSet = buildTransitiveClosureForCP(oldCons, resSet);
|
Set<Pair> tcOfoldConsSet = buildTransitiveClosureForCP(oldCons, resSet);
|
||||||
List<TPHConstraint> tcOfCs = buildTransitiveClosure(allConstraints);
|
List<TPHConstraint> tcOfCs = buildTransitiveClosure(allConstraints);
|
||||||
MethodAndTPH methAndTphs = methodAndTPH;
|
MethodAndTPH methAndTphs = methodAndTPH;
|
||||||
|
Set<Pair> undCons = methAndTphs.constraints.getUndConstraints();
|
||||||
List<Set<Constraint<Pair>>> orCons = methAndTphs.constraints.getOderConstraints();
|
List<Set<Constraint<Pair>>> orCons = methAndTphs.constraints.getOderConstraints();
|
||||||
List<HashMap<Relation, List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
|
List<HashMap<Relation, List<TPHConstraint>>> orConsListConverted = new ArrayList<>();
|
||||||
//gehe die OrConstraints der aktuellen Methode durch und teile nach Operator auf (
|
//gehe die OrConstraints der aktuellen Methode durch und teile nach Operator auf (
|
||||||
@ -567,9 +568,9 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dies ist das "R" aus dem ersten Teil, wird im zweiten Teil gebraucht
|
// dies ist das "R" aus dem ersten Teil, wird im zweiten Teil gebraucht
|
||||||
TypePlaceholder tphR = null;
|
// TypePlaceholder tphR = null;
|
||||||
Constraint<Pair> extendsSetAllOfOr = new Constraint<Pair>();
|
// Constraint<Pair> extendsSetAllOfOr = new Constraint<Pair>();
|
||||||
Constraint<Pair> equalSetAllOfOr = new Constraint<Pair>();
|
// Constraint<Pair> equalSetAllOfOr = new Constraint<Pair>();
|
||||||
|
|
||||||
// Berechnung des ersten Teils der Regel
|
// Berechnung des ersten Teils der Regel
|
||||||
for(int i=0; i<orCons.size(); i++) {
|
for(int i=0; i<orCons.size(); i++) {
|
||||||
@ -583,10 +584,10 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
Pair p = it.next();
|
Pair p = it.next();
|
||||||
if (p.OperatorSmallerDot()) {
|
if (p.OperatorSmallerDot()) {
|
||||||
extendsSet.add(p);
|
extendsSet.add(p);
|
||||||
extendsSetAllOfOr.add(p);
|
// extendsSetAllOfOr.add(p);
|
||||||
} else if (p.OperatorEqual()) {
|
} else if (p.OperatorEqual()) {
|
||||||
equalSet.add(p);
|
equalSet.add(p);
|
||||||
equalSetAllOfOr.add(p);
|
// equalSetAllOfOr.add(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Iterator<Pair> itExtends = extendsSet.iterator();
|
Iterator<Pair> itExtends = extendsSet.iterator();
|
||||||
@ -595,7 +596,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
Iterator<Pair> itEqual = equalSet.iterator();
|
Iterator<Pair> itEqual = equalSet.iterator();
|
||||||
while(itEqual.hasNext()) {
|
while(itEqual.hasNext()) {
|
||||||
Pair pairEqual = itEqual.next();
|
Pair pairEqual = itEqual.next();
|
||||||
tphR = (TypePlaceholder) (pairEqual.TA2);
|
// tphR = (TypePlaceholder) (pairEqual.TA2);
|
||||||
Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType, resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
Pair newPair = new Pair(resSet.resolveType((TypePlaceholder)(pairExtends.TA2)).resolvedType, resSet.resolveType((TypePlaceholder)(pairEqual.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||||
Iterator<Pair> itTC = tcOfoldConsSet.iterator();
|
Iterator<Pair> itTC = tcOfoldConsSet.iterator();
|
||||||
while(itTC.hasNext()) {
|
while(itTC.hasNext()) {
|
||||||
@ -634,28 +635,55 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Berechnung des zweiten Teils der Regel
|
// Berechnung des zweiten Teils der Regel
|
||||||
Iterator<Pair> itExtends2 = extendsSetAllOfOr.iterator();
|
for(int i=0; i<orCons.size(); i++) {
|
||||||
while(itExtends2.hasNext()) {
|
Constraint<Pair> extendsSet = new Constraint<Pair>();
|
||||||
Pair pairExtends2 = itExtends2.next();
|
Constraint<Pair> equalSet = new Constraint<Pair>();
|
||||||
Iterator<Pair> itEqual2 = equalSetAllOfOr.iterator();
|
//für jede einzelne OrConstraint-Menge gehe durch
|
||||||
while (itEqual2.hasNext()) {
|
for (Constraint con : orCons.get(i)) {
|
||||||
Pair pairEqual2 = itEqual2.next();
|
Iterator<Pair> it = con.iterator();
|
||||||
Pair newPair2 = new Pair(resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, resSet.resolveType((TypePlaceholder) (pairEqual2.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
while (it.hasNext()) {
|
||||||
boolean rEqRtilde = (tphR == pairEqual2.TA1 && checkForDuplicatesForSets(new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairEqual2.TA2)).resolvedType, PairOperator.EQUALSDOT), equalSetAllOfOr));
|
Pair p = it.next();
|
||||||
boolean rExRtilde = (tphR == pairExtends2.TA1 && checkForDuplicatesForSets(new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT), extendsSetAllOfOr));
|
if (p.OperatorSmallerDot()) {
|
||||||
Pair rExRtildePair = new Pair(resSet.resolveType((TypePlaceholder) (tphR)).resolvedType, resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, PairOperator.SMALLERDOT);
|
extendsSet.add(p);
|
||||||
boolean isPairInTExTapostrophe = checkForDuplicatesForSets(rExRtildePair, extendsSetAllOfOr);
|
} else if (p.OperatorEqual()) {
|
||||||
if (rEqRtilde || rExRtilde || !isPairInTExTapostrophe) {
|
equalSet.add(p);
|
||||||
if (newPair2.TA1 != newPair2.TA2) { //eliminieren der Fälle wie AA<.AA
|
}
|
||||||
if (!checkForDuplicatesForSets(newPair2, tempSet2)) {
|
}
|
||||||
tempSet2.add(newPair2);
|
Iterator<Pair> itExtends2 = extendsSet.iterator();
|
||||||
|
while(itExtends2.hasNext()) {
|
||||||
|
Pair pairExtends2 = itExtends2.next();
|
||||||
|
Iterator<Pair> itEqual2 = equalSet.iterator();
|
||||||
|
while (itEqual2.hasNext()) {
|
||||||
|
Pair pairEqual2 = itEqual2.next();
|
||||||
|
Pair newPair2 = new Pair(resSet.resolveType((TypePlaceholder) (pairExtends2.TA2)).resolvedType, resSet.resolveType((TypePlaceholder) (pairEqual2.TA1)).resolvedType, PairOperator.SMALLERDOT);
|
||||||
|
TypePlaceholder tphR = (TypePlaceholder) pairEqual2.TA2;
|
||||||
|
Iterator<Pair> itUndCons = undCons.iterator();
|
||||||
|
while (itUndCons.hasNext()) {
|
||||||
|
Pair pairUndCons2 = itUndCons.next();
|
||||||
|
boolean rEqRtilde = (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);
|
||||||
|
boolean isPairInTExTapostrophe = checkForDuplicatesForSets(rExRtildePair, extendsSet);
|
||||||
|
|
||||||
|
if (rEqRtilde || rExRtilde || isPairInTExTapostrophe) {
|
||||||
|
if (newPair2.TA1 != newPair2.TA2) { //eliminieren der Fälle wie AA<.AA
|
||||||
|
if (!checkForDuplicatesForSets(newPair2, tempSet2)) {
|
||||||
|
tempSet2.add(pairExtends2);
|
||||||
|
tempSet2.add(newPair2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// aus der alten Datenstruktur in die neue Datenstruktur (von Ali) für ersten Teil
|
// aus der alten Datenstruktur in die neue Datenstruktur (von Ali) für ersten Teil
|
||||||
Iterator<Pair> itTemp = tempSet.iterator();
|
Iterator<Pair> itTemp = tempSet.iterator();
|
||||||
while(itTemp.hasNext()) {
|
while(itTemp.hasNext()) {
|
||||||
|
@ -65,6 +65,7 @@ public class TestTwoCalls {
|
|||||||
lmc.add(new MethodConstraint("T", "O", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("T", "O", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("O", "R", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("O", "R", Relation.EXTENDS));
|
||||||
lmc.add(new MethodConstraint("R", "java/lang/Object", Relation.EXTENDS));
|
lmc.add(new MethodConstraint("R", "java/lang/Object", Relation.EXTENDS));
|
||||||
|
lmc.add(new MethodConstraint("S", "java/lang/Object", Relation.EXTENDS));
|
||||||
methodConstraintsWithPositionTest.put("TPH Rmain(TPH STPH T)", lmc);
|
methodConstraintsWithPositionTest.put("TPH Rmain(TPH STPH T)", lmc);
|
||||||
|
|
||||||
FamilyOfGeneratedGenerics fogg = compiler.fogg;
|
FamilyOfGeneratedGenerics fogg = compiler.fogg;
|
||||||
|
Loading…
Reference in New Issue
Block a user