forked from JavaTX/JavaCompilerCore
modified: src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java
modified: src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
This commit is contained in:
parent
d14f1d92c9
commit
31d7856afa
@ -134,7 +134,7 @@ public class GeneratedGenericsFinder implements ASTVisitor {
|
|||||||
classOrInterface.accept(tphExtractor);
|
classOrInterface.accept(tphExtractor);
|
||||||
//PL 2020-10-16: Ab hier GGenerics implementieren durch Ali
|
//PL 2020-10-16: Ab hier GGenerics implementieren durch Ali
|
||||||
//Rueckgabe an generatedGenericsForSF
|
//Rueckgabe an generatedGenericsForSF
|
||||||
fogg = new FamilyOfGeneratedGenerics(tphExtractor);
|
fogg = new FamilyOfGeneratedGenerics(tphExtractor, resultSet);
|
||||||
|
|
||||||
System.out.println("fogg.allConstraints: "+ fogg.allConstraints);
|
System.out.println("fogg.allConstraints: "+ fogg.allConstraints);
|
||||||
System.out.println("fogg.posOfTPHs: "+ fogg.posOfTPHs);
|
System.out.println("fogg.posOfTPHs: "+ fogg.posOfTPHs);
|
||||||
|
@ -5,11 +5,18 @@ import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
|||||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
import java.util.function.Predicate;
|
||||||
import java.util.List;
|
|
||||||
|
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||||
|
import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
||||||
|
import de.dhbwstuttgart.typeinference.constraints.Pair;
|
||||||
|
import de.dhbwstuttgart.typeinference.result.ResultPair;
|
||||||
|
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||||
import org.objectweb.asm.Type;
|
import org.objectweb.asm.Type;
|
||||||
|
|
||||||
|
import javax.naming.ldap.PagedResultsResponseControl;
|
||||||
|
|
||||||
public class FamilyOfGeneratedGenerics {
|
public class FamilyOfGeneratedGenerics {
|
||||||
public List<TPHConstraint> allConstraints = new ArrayList<>();
|
public List<TPHConstraint> allConstraints = new ArrayList<>();
|
||||||
// HashMap speichert ob TPH in einer Methode oder in der Klasse ist; und wenn es in der Methode ist, in welcher Methode
|
// HashMap speichert ob TPH in einer Methode oder in der Klasse ist; und wenn es in der Methode ist, in welcher Methode
|
||||||
@ -17,15 +24,19 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
public List<ClassConstraint> classConstraints = new ArrayList<>();
|
public List<ClassConstraint> classConstraints = new ArrayList<>();
|
||||||
public List<MethodConstraint> methodConstraints = new ArrayList<>();
|
public List<MethodConstraint> methodConstraints = new ArrayList<>();
|
||||||
public HashMap<String, List<MethodConstraint>> methodConstraintsWithPosition = new HashMap<>();
|
public HashMap<String, List<MethodConstraint>> methodConstraintsWithPosition = new HashMap<>();
|
||||||
|
// public List<MethodAndTPH> methodAndTPHList = new ArrayList<>(); //not necessary?
|
||||||
|
public ResultSet resSet;
|
||||||
|
|
||||||
private static final String objectType = Type.getInternalName(Object.class);
|
private static final String objectType = Type.getInternalName(Object.class);
|
||||||
|
|
||||||
public FamilyOfGeneratedGenerics(TPHExtractor tphExtractor) {
|
public FamilyOfGeneratedGenerics(TPHExtractor tphExtractor, ResultSet resultSet) {
|
||||||
|
this.resSet = resultSet;
|
||||||
this.allConstraints = tphExtractor.allCons;
|
this.allConstraints = tphExtractor.allCons;
|
||||||
this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph);
|
this.posOfTPHs = positionConverter(tphExtractor.allTPHS, tphExtractor.ListOfMethodsAndTph);
|
||||||
this.classConstraints = getClassConstraints(allConstraints,posOfTPHs);
|
this.classConstraints = getClassConstraints(allConstraints,posOfTPHs);
|
||||||
this.methodConstraints = getMethodConstraints(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph);
|
this.methodConstraints = getMethodConstraints(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph);
|
||||||
this.methodConstraintsWithPosition = getMethodConstraintsWithPosition(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph);
|
this.methodConstraintsWithPosition = getMethodConstraintsWithPosition(allConstraints,classConstraints,posOfTPHs, tphExtractor.ListOfMethodsAndTph, resSet);
|
||||||
|
// this.methodAndTPHList = tphExtractor.ListOfMethodsAndTph; //not necessary?
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
public static List<ClassConstraint> getClassConstraints(List<TPHConstraint> cs, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs) { //Inputparameter List<TPHConstraint> constraintsSet weg
|
||||||
@ -104,7 +115,7 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
return cs_m;
|
return cs_m;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPosition(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph) {
|
public static HashMap<String, List<MethodConstraint>> getMethodConstraintsWithPosition(List<TPHConstraint> cs, List<ClassConstraint> cs_cl, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, List<MethodAndTPH> listOfMethodsAndTph, ResultSet resSet) {
|
||||||
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
|
HashMap<String, List<MethodConstraint>> tempMethodConstraintsWithPosition = new HashMap<>();
|
||||||
for(MethodAndTPH method: listOfMethodsAndTph){
|
for(MethodAndTPH method: listOfMethodsAndTph){
|
||||||
List<String> methodsAddedToHashMap = new ArrayList<>();
|
List<String> methodsAddedToHashMap = new ArrayList<>();
|
||||||
@ -124,6 +135,8 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
listOfThisMethod = getMethodConstraints(cs,cs_cl,posOfTPHsForThisMethod,listOfMethodsAndTph);
|
listOfThisMethod = getMethodConstraints(cs,cs_cl,posOfTPHsForThisMethod,listOfMethodsAndTph);
|
||||||
tempMethodConstraintsWithPosition.put(currentMethod, listOfThisMethod);
|
tempMethodConstraintsWithPosition.put(currentMethod, listOfThisMethod);
|
||||||
|
|
||||||
|
List<MethodConstraint> newMCList = firstLineMethodDefinition(cs, posOfTphs, resSet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,4 +477,38 @@ public class FamilyOfGeneratedGenerics {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
public static List<MethodConstraint> firstLineMethodDefinition(List<TPHConstraint> allConstraints, HashMap<String, List<PairTphMethod<PositionFinder.Position, String>>> posOfTphs, ResultSet resSet) {
|
||||||
|
List<MethodConstraint> tempMC= new ArrayList<>();
|
||||||
|
// MethodAndTPH methAndTphs = methodAndTPH;
|
||||||
|
// Set undCons = methAndTphs.constraints.getUndConstraints();
|
||||||
|
// Iterator it = undCons.iterator();
|
||||||
|
// while(it.hasNext()) {
|
||||||
|
// System.out.println(it.next());
|
||||||
|
// }
|
||||||
|
Set res = resSet.results;
|
||||||
|
Iterator it = res.iterator();
|
||||||
|
System.out.println("res: " + res.size() + res);
|
||||||
|
System.out.println("booooooooo");
|
||||||
|
while(it.hasNext()) {
|
||||||
|
System.out.println(it.next());
|
||||||
|
}
|
||||||
|
System.out.println("booooooooo2");
|
||||||
|
|
||||||
|
// for(TPHConstraint tphC: allConstraints) {
|
||||||
|
// }
|
||||||
|
Predicate<Pair> filterUndConstraints = ab -> resSet.resolveType((TypePlaceholder)(ab.TA1)).resolvedType instanceof TypePlaceholder;
|
||||||
|
System.out.println(filterUndConstraints);
|
||||||
|
Predicate<Pair> the = x -> resSet.resolveType((TypePlaceholder)(x.TA1)).resolvedType instanceof TypePlaceholder;
|
||||||
|
ResultPair rp = y -> resSet.resolveType((TypePlaceholder)(y.TA1)).getResultPair();
|
||||||
|
|
||||||
|
// (resultSet.resolveType((TypePlaceholder)(cs.TA1)).resolvedType instanceof TypePlaceholder)
|
||||||
|
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user