TPHs, die nicht in ParameterListe der Methode vorkommen, werden in Signature geschrieben
This commit is contained in:
parent
162ca3eb27
commit
23eab0c9a4
@ -286,9 +286,13 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
|
|
||||||
HashMap<TypePlaceholder, TypePlaceholder> subAndSuperTph = new HashMap<>();
|
HashMap<TypePlaceholder, TypePlaceholder> subAndSuperTph = new HashMap<>();
|
||||||
for(GenericInsertPair p : allPairs) {
|
for(GenericInsertPair p : allPairs) {
|
||||||
|
// Tph2.jav
|
||||||
|
if(subAndSuperTph.containsKey(p.TA1)) {
|
||||||
|
if(methodTphs.contains(subAndSuperTph.get(p.TA1)))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
subAndSuperTph.put(p.TA1, p.TA2);
|
subAndSuperTph.put(p.TA1, p.TA2);
|
||||||
}
|
}
|
||||||
|
|
||||||
int numOfVisitedPairs = 0;
|
int numOfVisitedPairs = 0;
|
||||||
for(TypePlaceholder subTph: subAndSuperTph.keySet()) {
|
for(TypePlaceholder subTph: subAndSuperTph.keySet()) {
|
||||||
|
|
||||||
@ -320,7 +324,6 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
TypePlaceholder subTphRes = tphsInRel.get(0);
|
TypePlaceholder subTphRes = tphsInRel.get(0);
|
||||||
// Die größte Supertype
|
// Die größte Supertype
|
||||||
TypePlaceholder superTphRes = tphsInRel.get(tphsInRel.size()-1);
|
TypePlaceholder superTphRes = tphsInRel.get(tphsInRel.size()-1);
|
||||||
|
|
||||||
int i = 2;
|
int i = 2;
|
||||||
while(!methodTphs.contains(superTphRes) && (tphsInRel.size()-i) >0) {
|
while(!methodTphs.contains(superTphRes) && (tphsInRel.size()-i) >0) {
|
||||||
superTphRes = tphsInRel.get(tphsInRel.size()-i);
|
superTphRes = tphsInRel.get(tphsInRel.size()-i);
|
||||||
@ -330,7 +333,6 @@ public class BytecodeGen implements ASTVisitor {
|
|||||||
GenericInsertPair sPair = new GenericInsertPair(subTphRes, superTphRes);
|
GenericInsertPair sPair = new GenericInsertPair(subTphRes, superTphRes);
|
||||||
simplifiedPairs.add(sPair);
|
simplifiedPairs.add(sPair);
|
||||||
}
|
}
|
||||||
|
|
||||||
return simplifiedPairs;
|
return simplifiedPairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +147,33 @@ public class Signature {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(GenericInsertPair p:methodPairs) {
|
||||||
|
String name = p.TA1.getName()+"$";
|
||||||
|
if(!genericsAndBoundsMethod.containsKey(name)) {
|
||||||
|
sw.visitFormalTypeParameter(name);
|
||||||
|
sw.visitClassBound().visitTypeVariable(p.TA2.getName()+"$");
|
||||||
|
genericsAndBoundsMethod.put(name, p.TA2.getName()+"$");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<TypePlaceholder> types = new ArrayList<>();
|
||||||
|
ArrayList<TypePlaceholder> superTypes = new ArrayList<>();
|
||||||
|
|
||||||
|
for(GenericInsertPair p : methodPairs) {
|
||||||
|
types.add(p.TA1);
|
||||||
|
superTypes.add(p.TA2);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(GenericInsertPair p : methodPairs) {
|
||||||
|
String name = p.TA2.getName()+"$";
|
||||||
|
if(!types.contains(p.TA2) && !genericsAndBoundsMethod.containsKey(name)) {
|
||||||
|
String bound = Type.getInternalName(Object.class);
|
||||||
|
sw.visitFormalTypeParameter(name);
|
||||||
|
sw.visitClassBound().visitClassType(bound);
|
||||||
|
genericsAndBoundsMethod.put(name, bound);
|
||||||
|
sw.visitClassBound().visitEnd();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// visit each method-parameter to create the signature
|
// visit each method-parameter to create the signature
|
||||||
|
Loading…
Reference in New Issue
Block a user