Merged with simplifyRes and cleaned up code
This commit is contained in:
parent
3ecb202a90
commit
25c685c705
@ -3,13 +3,9 @@ package de.dhbwstuttgart.bytecode;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.FieldVisitor;
|
||||
@ -18,22 +14,18 @@ import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.DescriptorToString;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.signature.Signature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToString;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.SimplifyResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalConstructor;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NormalMethod;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Resolver;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Simplify;
|
||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
|
||||
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
|
||||
@ -80,7 +72,6 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.result.GenericInsertPair;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
|
||||
public class BytecodeGen implements ASTVisitor {
|
||||
@ -204,7 +195,7 @@ public class BytecodeGen implements ASTVisitor {
|
||||
List<GenericsGeneratorResult> consClass = generatedGenerics.getClassConstraints();
|
||||
//
|
||||
Signature signature = new Signature(classOrInterface, genericsAndBounds, consClass);
|
||||
sig = signature.toString();
|
||||
sig = signature.createSignatureForClassOrInterface();
|
||||
System.out.println("Signature: => " + sig);
|
||||
}
|
||||
|
||||
@ -219,12 +210,7 @@ public class BytecodeGen implements ASTVisitor {
|
||||
}
|
||||
|
||||
for (Constructor c : classOrInterface.getConstructors()) {
|
||||
// if(!isConsWithNoParamsVisited) {
|
||||
c.accept(this);
|
||||
// }
|
||||
|
||||
// if(!c.getParameterList().iterator().hasNext())
|
||||
// isConsWithNoParamsVisited = true;
|
||||
}
|
||||
|
||||
for (Method m : classOrInterface.getMethods()) {
|
||||
@ -237,12 +223,6 @@ public class BytecodeGen implements ASTVisitor {
|
||||
|
||||
@Override
|
||||
public void visit(Constructor field) {
|
||||
System.out.println("ResultSet: ");
|
||||
resultSet.results.forEach(a -> {
|
||||
System.out.println(a.getLeft().toString() + " = " + a.getRight().toString());
|
||||
});
|
||||
System.out.println("---------------");
|
||||
|
||||
// stores generics and their bounds of method
|
||||
HashMap<String, String> genericsAndBoundsMethod = new HashMap<>();
|
||||
|
||||
@ -270,15 +250,10 @@ public class BytecodeGen implements ASTVisitor {
|
||||
String sig = null;
|
||||
if (hasGen) {
|
||||
List<GenericsGeneratorResult> constraints = generatedGenerics.getClassConstraints();
|
||||
// Map<TPHConstraint, Set<String>> constraints = generatedGenerics.getMethodConstraintsByID(methParamTypes);
|
||||
//// ArrayList<GenericInsertPair> pairs = simplifyPairs(method.name,tphExtractor.allPairs,tphExtractor.allCons);
|
||||
Signature signature = new Signature(genericsAndBounds,
|
||||
methodParamsAndTypes, resultSet, constraints);
|
||||
|
||||
sig = signature.createSignatureForConstructor(field);
|
||||
// Map<TPHConstraint, Set<String>> constraints = generatedGenerics.getMethodConstraintsByID(methParamTypes);
|
||||
// Signature signature = new Signature(field, genericsAndBounds, methodParamsAndTypes, resultSet, constraints);
|
||||
// sig = signature.toString();
|
||||
}
|
||||
if (field.getParameterList().iterator().hasNext())
|
||||
System.out.println(field.getParameterList().iterator().next().getType().acceptTV(new TypeToDescriptor()));
|
||||
@ -363,8 +338,6 @@ public class BytecodeGen implements ASTVisitor {
|
||||
|
||||
List<GenericsGeneratorResult> constraints = generatedGenerics.getMethodConstraintsByID(id);
|
||||
List<GenericsGeneratorResult> classConstraints = generatedGenerics.getClassConstraints();
|
||||
// Map<TPHConstraint, Set<String>> constraints = generatedGenerics.getMethodConstraintsByID(methParamTypes);
|
||||
//// ArrayList<GenericInsertPair> pairs = simplifyPairs(method.name,tphExtractor.allPairs,tphExtractor.allCons);
|
||||
Signature signature = new Signature(genericsAndBoundsMethod, genericsAndBounds,
|
||||
methodParamsAndTypes, resultSet, constraints,classConstraints);
|
||||
sig = signature.createSignatureForMethod(method);
|
||||
@ -373,7 +346,6 @@ public class BytecodeGen implements ASTVisitor {
|
||||
NormalMethod meth = new NormalMethod(method, genericsAndBounds, genericsAndBoundsMethod, hasGen);
|
||||
methDesc = meth.accept(new DescriptorToString(resultSet));
|
||||
|
||||
// System.out.println(methDesc);
|
||||
MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC + acc, method.getName(), methDesc, sig, null);
|
||||
|
||||
mv.visitCode();
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.NameReplacementResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.NameReplacementResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||
|
||||
/**
|
||||
* This class represents the result of the constraints simplifier.
|
@ -7,8 +7,7 @@ import java.util.*;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.ConstraintsSimplierResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
@ -19,7 +18,6 @@ public class ConstraintsSimplifier {
|
||||
|
||||
List<TPHConstraint> allCons = tphExtractor.allCons;
|
||||
List<TPHConstraint> equalCons = new ArrayList<>();
|
||||
List<SimpleCycle> simpleCycles = findSimpleCycles(allCons);
|
||||
|
||||
/* Step 1 */
|
||||
List<ConstraintsWithSameLeftSide> foundCons = GenericsGeneratorUtility.findConstraintsWithLeftSameLeftSide(allCons);
|
||||
@ -34,10 +32,10 @@ public class ConstraintsSimplifier {
|
||||
// equalCons.addAll(GenericsGeneratorUtility.getEqualConstraints(allCons));
|
||||
// }
|
||||
//
|
||||
List<LongCycle> longCycles = findLongCycles(allCons);
|
||||
List<Cycle> cycles = findCycles(allCons);
|
||||
|
||||
if(!longCycles.isEmpty()) {
|
||||
handleLongCycle(genericsGeneratorResults, allCons, longCycles,tphExtractor);
|
||||
if(!cycles.isEmpty()) {
|
||||
handleCycle(genericsGeneratorResults, allCons, cycles,tphExtractor);
|
||||
}
|
||||
/* The right hand side of equal constraint is the new name in name replacement result */
|
||||
List<NameReplacementResult> nameReplacementResults = GenericsGeneratorUtility.createNameReplacementResultsFromEqualConstraints(equalCons);
|
||||
@ -114,13 +112,13 @@ public class ConstraintsSimplifier {
|
||||
/**
|
||||
* @param genericsGeneratorResults
|
||||
* @param allCons
|
||||
* @param longCycles
|
||||
* @param cycles
|
||||
* @param tphExtractor
|
||||
*/
|
||||
public static void handleLongCycle(List<GenericsGeneratorResult> genericsGeneratorResults,
|
||||
List<TPHConstraint> allCons, List<LongCycle> longCycles, TPHExtractor tphExtractor) {
|
||||
GenericsGeneratorUtility.modifyRelationForConstraintsinLongCycle(longCycles);
|
||||
List<NameReplacementResult> nameReplacementResults = GenericsGeneratorUtility.substituteTPHSFormLongCycle(allCons, longCycles,tphExtractor);
|
||||
public static void handleCycle(List<GenericsGeneratorResult> genericsGeneratorResults,
|
||||
List<TPHConstraint> allCons, List<Cycle> cycles, TPHExtractor tphExtractor) {
|
||||
GenericsGeneratorUtility.modifyRelationForConstraintsInCycle(cycles);
|
||||
List<NameReplacementResult> nameReplacementResults = GenericsGeneratorUtility.substituteTPHSFormCycle(allCons, cycles,tphExtractor);
|
||||
GenericsGeneratorUtility.createResults(genericsGeneratorResults,nameReplacementResults);
|
||||
GenericsGeneratorUtility.removeEqualConstraints(allCons);
|
||||
}
|
||||
@ -129,33 +127,11 @@ public class ConstraintsSimplifier {
|
||||
* @param allCons
|
||||
* @return
|
||||
*/
|
||||
public static List<LongCycle> findLongCycles(List<TPHConstraint> allCons) {
|
||||
/* find all long cycles */
|
||||
public static List<Cycle> findCycles(List<TPHConstraint> allCons) {
|
||||
/* find all cycles */
|
||||
CyclesFinder cyclesFinder = new CyclesFinder(allCons);
|
||||
List<LongCycle> longCycles = cyclesFinder.findLongCycles();
|
||||
return longCycles;
|
||||
List<Cycle> cycles = cyclesFinder.findCycles();
|
||||
return cycles;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allCons
|
||||
* @param simpleCycles
|
||||
* @param tphExtractor
|
||||
*/
|
||||
public static void handleSimpleCycles(List<TPHConstraint> allCons, List<SimpleCycle> simpleCycles, TPHExtractor tphExtractor) {
|
||||
GenericsGeneratorUtility.modifyRelation(simpleCycles);
|
||||
GenericsGeneratorUtility.removeAllReverseConstraints(allCons,simpleCycles);
|
||||
GenericsGeneratorUtility.substituteTPH(allCons, simpleCycles);
|
||||
GenericsGeneratorUtility.replaceOldNames(simpleCycles,tphExtractor);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param allCons
|
||||
* @return
|
||||
*/
|
||||
public static List<SimpleCycle> findSimpleCycles(List<TPHConstraint> allCons) {
|
||||
CyclesFinder cyclesFinder = new CyclesFinder(allCons);
|
||||
/* find all simple cycles if they are exist */
|
||||
List<SimpleCycle> simpleCycles = cyclesFinder.findSimpleCycles();
|
||||
return simpleCycles;
|
||||
}
|
||||
}
|
||||
|
@ -10,6 +10,7 @@ import java.util.Optional;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.Cycle;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
@ -22,46 +23,22 @@ public class CyclesFinder {
|
||||
this.allCons = allCons;
|
||||
}
|
||||
|
||||
public List<SimpleCycle> findSimpleCycles() {
|
||||
List<SimpleCycle> simpleCycles = new ArrayList<>();
|
||||
allCons.forEach(c -> {
|
||||
String left = c.getLeft();
|
||||
String right = c.getRight();
|
||||
if (c.getRel() == Relation.EXTENDS && !containsInCycle(c, simpleCycles)) {
|
||||
Optional<TPHConstraint> revCon = GenericsGeneratorUtility.getReverseConstraint(allCons, left, right);
|
||||
if (revCon.isPresent()) {
|
||||
TPHConstraint reverseConstraint = revCon.get();
|
||||
SimpleCycle simpleCycle = new SimpleCycle(c, reverseConstraint);
|
||||
simpleCycles.add(simpleCycle);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return simpleCycles;
|
||||
}
|
||||
|
||||
private boolean containsInCycle(TPHConstraint c, List<SimpleCycle> simpleCycles) {
|
||||
return simpleCycles.stream().filter(sc -> {
|
||||
return sc.contains(c);
|
||||
}).count() > 0;
|
||||
}
|
||||
|
||||
public List<LongCycle> findLongCycles() {
|
||||
public List<Cycle> findCycles() {
|
||||
List<TPHConstraint> vistedConstraints = new ArrayList<>(allCons.size());
|
||||
List<LongCycle> longCycles = new ArrayList<>();
|
||||
List<Cycle> cycles = new ArrayList<>();
|
||||
for (TPHConstraint constraint : allCons) {
|
||||
if(constraint.getRel()==Relation.EQUAL)
|
||||
continue;
|
||||
if (!vistedConstraints.contains(constraint)) {
|
||||
vistedConstraints.add(constraint);
|
||||
checkConstraint(constraint, vistedConstraints, longCycles);
|
||||
checkConstraint(constraint, vistedConstraints, cycles);
|
||||
}
|
||||
}
|
||||
return longCycles;
|
||||
return cycles;
|
||||
}
|
||||
|
||||
private void checkConstraint(TPHConstraint constraint, List<TPHConstraint> vistedConstraints,
|
||||
List<LongCycle> longCycles) {
|
||||
List<Cycle> cycles) {
|
||||
List<String> tphsInRelation = new LinkedList<>();
|
||||
List<TPHConstraint> maybeCycle = new ArrayList<>();
|
||||
maybeCycle.add(constraint);
|
||||
@ -69,13 +46,13 @@ public class CyclesFinder {
|
||||
tphsInRelation.add(constraint.getRight());
|
||||
Optional<TPHConstraint> nextConstraint = getConstraintInRelation(tphsInRelation, maybeCycle);
|
||||
while (nextConstraint.isPresent()) {
|
||||
if(containsInLongCycle(nextConstraint.get(), longCycles)) {
|
||||
if(containsInLongCycle(nextConstraint.get(), cycles)) {
|
||||
break;
|
||||
}
|
||||
if (isCycle(tphsInRelation)) {
|
||||
addAllToVisitedConstraints(vistedConstraints, maybeCycle);
|
||||
LongCycle cycle = new LongCycle(maybeCycle);
|
||||
longCycles.add(cycle);
|
||||
Cycle cycle = new Cycle(maybeCycle);
|
||||
cycles.add(cycle);
|
||||
return;
|
||||
}
|
||||
nextConstraint = getConstraintInRelation(tphsInRelation, maybeCycle);
|
||||
@ -84,8 +61,8 @@ public class CyclesFinder {
|
||||
// addAllToVisitedConstraints(vistedConstraints, maybeCycle);
|
||||
}
|
||||
|
||||
private boolean containsInLongCycle(TPHConstraint c, List<LongCycle> longCycles) {
|
||||
for(LongCycle cycle : longCycles) {
|
||||
private boolean containsInLongCycle(TPHConstraint c, List<Cycle> cycles) {
|
||||
for(Cycle cycle : cycles) {
|
||||
if(cycle.containConstraint(c))
|
||||
return true;
|
||||
}
|
||||
|
@ -1,32 +1,20 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.BytecodeGen;
|
||||
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.GenericsGenerator;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.GenericsGeneratorUtility;
|
||||
import de.dhbwstuttgart.bytecode.signature.Signature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToSignature;
|
||||
import de.dhbwstuttgart.bytecode.signature.TypeToString;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.MethodAndConstraints;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Resolver;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Simplify;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.AssignToLocal;
|
||||
import de.dhbwstuttgart.syntaxtree.ASTVisitor;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
@ -69,7 +57,6 @@ import de.dhbwstuttgart.syntaxtree.statement.WhileStmt;
|
||||
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
@ -148,14 +135,8 @@ public class GeneratedGenericsFinder implements ASTVisitor {
|
||||
if(!isVisited) {
|
||||
ggResult = GenericsGenerator.generateConstraints(className, tphExtractor, tphsClass,simplifiedConstraints);
|
||||
isVisited = true;
|
||||
} else {
|
||||
|
||||
}
|
||||
|
||||
// for(Constructor m : classOrInterface.getConstructors()) {
|
||||
// addMethodConstraints(simplifiedConstraints, ggResult, m);
|
||||
// }
|
||||
|
||||
for(Method m : classOrInterface.getMethods()) {
|
||||
addMethodConstraints(simplifiedConstraints, ggResult, m);
|
||||
|
@ -11,18 +11,13 @@ import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
||||
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericGeneratorResultsForAllMethods;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.ConstraintsSimplierResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.MethodAndConstraints;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||
import de.dhbwstuttgart.syntaxtree.Method;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
|
@ -12,6 +12,7 @@ import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.*;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.TPHExtractor;
|
||||
@ -19,7 +20,6 @@ import de.dhbwstuttgart.bytecode.constraint.EqualConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.utilities.ConstraintsFinder;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodAndTPH;
|
||||
import de.dhbwstuttgart.bytecode.utilities.NameReplacer;
|
||||
@ -74,21 +74,6 @@ public class GenericsGeneratorUtility {
|
||||
|
||||
}
|
||||
|
||||
public static void modifyRelation(List<SimpleCycle> simpleCycles) {
|
||||
simpleCycles.forEach(sc->{
|
||||
sc.getConstraint().setRel(Relation.EQUAL);
|
||||
sc.getReverseConstraint().setRel(Relation.EQUAL);
|
||||
});
|
||||
}
|
||||
|
||||
public static void removeAllReverseConstraints(List<TPHConstraint> allCons, List<SimpleCycle> simpleCycles) {
|
||||
simpleCycles.forEach(sc->allCons.remove(sc.getReverseConstraint()));
|
||||
}
|
||||
|
||||
public static void substituteTPH(List<TPHConstraint> allCons, List<SimpleCycle> simpleCycles) {
|
||||
simpleCycles.forEach(sc->substituteTPH(allCons, sc.getConstraint().getLeft(), sc.getConstraint().getRight()));
|
||||
}
|
||||
|
||||
public static List<ConstraintsWithSameLeftSide> findConstraintsWithLeftSameLeftSide(List<TPHConstraint> allCons) {
|
||||
// finder looks for constraints that have the same left hand side
|
||||
// and put them in a list
|
||||
@ -279,13 +264,13 @@ public class GenericsGeneratorUtility {
|
||||
|
||||
}
|
||||
|
||||
public static void modifyRelationForConstraintsinLongCycle(List<LongCycle> longCycles) {
|
||||
longCycles.stream().map(lc->lc.getConstraints()).flatMap(e->e.stream()).forEach(c->c.setRel(Relation.EQUAL));
|
||||
public static void modifyRelationForConstraintsInCycle(List<Cycle> cycles) {
|
||||
cycles.stream().map(lc->lc.getConstraints()).flatMap(e->e.stream()).forEach(c->c.setRel(Relation.EQUAL));
|
||||
}
|
||||
|
||||
public static List<NameReplacementResult> substituteTPHSFormLongCycle(List<TPHConstraint> allCons, List<LongCycle> longCycles, TPHExtractor tphExtractor) {
|
||||
public static List<NameReplacementResult> substituteTPHSFormCycle(List<TPHConstraint> allCons, List<Cycle> cycles, TPHExtractor tphExtractor) {
|
||||
List<NameReplacementResult> results = new ArrayList<>();
|
||||
longCycles.forEach(lc->{
|
||||
cycles.forEach(lc->{
|
||||
Set<String> names = getNamesFromCycle(lc);
|
||||
String newName = names.stream().findFirst().get();
|
||||
|
||||
@ -328,7 +313,7 @@ public class GenericsGeneratorUtility {
|
||||
});
|
||||
}
|
||||
|
||||
public static Set<String> getNamesFromCycle(LongCycle lc) {
|
||||
public static Set<String> getNamesFromCycle(Cycle lc) {
|
||||
Set<String> names = new HashSet<>();
|
||||
lc.getConstraints().forEach(c->names.add(c.getLeft()));
|
||||
return names;
|
||||
@ -388,23 +373,6 @@ public class GenericsGeneratorUtility {
|
||||
return allCons.stream().filter(c->c.getRight().equals(tph)).findFirst();
|
||||
}
|
||||
|
||||
public static void replaceOldNames(List<SimpleCycle> simpleCycles, TPHExtractor tphExtractor) {
|
||||
simpleCycles.forEach(sc -> {
|
||||
Stream<ArrayList<String>> tphsOfMethods = tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getTphs());
|
||||
Stream<ArrayList<String>> localTphsOfMethods = tphExtractor.ListOfMethodsAndTph.stream().map(m->m.getLocalTphs());
|
||||
|
||||
String newName = sc.getConstraint().getRight();
|
||||
String oldName = sc.getConstraint().getLeft();
|
||||
|
||||
List<String> names = new ArrayList<>();
|
||||
names.add(oldName);
|
||||
names.add(newName);
|
||||
|
||||
replaceOldNames(newName, names, tphsOfMethods);
|
||||
replaceOldNames(newName, names, localTphsOfMethods);
|
||||
});
|
||||
}
|
||||
|
||||
public static boolean isTPHInGenericGeneratorResult(final List<GenericsGeneratorResult> constraints, final String tph) {
|
||||
return constraints.stream().filter(g->g.getConstraint().getLeft().equals(tph)).findFirst().isPresent();
|
||||
}
|
||||
|
@ -1,69 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class SimpleCycle {
|
||||
private TPHConstraint constraint;
|
||||
private TPHConstraint reverseConstraint;
|
||||
|
||||
/**
|
||||
* @param constraint
|
||||
* @param reverseConstraint
|
||||
*/
|
||||
public SimpleCycle(TPHConstraint constraint, TPHConstraint reverseConstraint) {
|
||||
this.constraint = constraint;
|
||||
this.reverseConstraint = reverseConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the constraint
|
||||
*/
|
||||
public TPHConstraint getConstraint() {
|
||||
return constraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param constraint the constraint to set
|
||||
*/
|
||||
public void setConstraint(TPHConstraint constraint) {
|
||||
this.constraint = constraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the reverseConstraint
|
||||
*/
|
||||
public TPHConstraint getReverseConstraint() {
|
||||
return reverseConstraint;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param reverseConstraint the reverseConstraint to set
|
||||
*/
|
||||
public void setReverseConstraint(TPHConstraint reverseConstraint) {
|
||||
this.reverseConstraint = reverseConstraint;
|
||||
}
|
||||
|
||||
public boolean contains(TPHConstraint c) {
|
||||
if (constraint.getLeft().equals(c.getLeft()) && constraint.getRight().equals(c.getRight())
|
||||
&& constraint.getRel().equals(c.getRel()))
|
||||
return true;
|
||||
if (reverseConstraint.getLeft().equals(c.getLeft()) && reverseConstraint.getRight().equals(c.getRight())
|
||||
&& reverseConstraint.getRel().equals(c.getRel()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return constraint.toString() + " -> " + reverseConstraint.toString();
|
||||
}
|
||||
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -11,13 +11,13 @@ import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class LongCycle {
|
||||
public class Cycle {
|
||||
private final List<TPHConstraint> constraints;
|
||||
|
||||
/**
|
||||
* @param constraints
|
||||
*/
|
||||
public LongCycle(List<TPHConstraint> constraints) {
|
||||
public Cycle(List<TPHConstraint> constraints) {
|
||||
this.constraints = constraints;
|
||||
}
|
||||
|
@ -1,13 +1,11 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import com.google.common.collect.Collections2;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
*
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -1,7 +1,7 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.genericsGenerator;
|
||||
package de.dhbwstuttgart.bytecode.genericsGeneratorTypes;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -6,12 +6,9 @@ import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.signature.SignatureVisitor;
|
||||
import org.objectweb.asm.signature.SignatureWriter;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.ExtendsConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Simplify;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.Constructor;
|
||||
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
|
||||
@ -22,8 +19,6 @@ import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.SuperWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
|
||||
import de.dhbwstuttgart.typeinference.result.ResolvedType;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
|
||||
public class Signature {
|
||||
@ -75,21 +70,18 @@ public class Signature {
|
||||
this.classOrInterface = classOrInterface;
|
||||
this.genericsAndBounds = genericsAndBounds;
|
||||
this.consClass = consClass;
|
||||
createSignatureForClassOrInterface();
|
||||
}
|
||||
|
||||
public Signature(HashMap<String, String> genericsAndBoundsMethod,
|
||||
HashMap<String, String> genericsAndBounds,
|
||||
HashMap<String, RefTypeOrTPHOrWildcardOrGeneric> methodParamsAndTypes, ResultSet resultSet,
|
||||
List<GenericsGeneratorResult> constraints,List<GenericsGeneratorResult> consClass) {
|
||||
//this.method = method;
|
||||
this.genericsAndBoundsMethod = genericsAndBoundsMethod;
|
||||
this.genericsAndBounds = genericsAndBounds;
|
||||
this.methodParamsAndTypes = methodParamsAndTypes;
|
||||
this.resultSet = resultSet;
|
||||
this.constraints = constraints;
|
||||
this.consClass = consClass;
|
||||
//createSignatureForMethod(this.method);
|
||||
}
|
||||
|
||||
public String createSignatureForConstructor(Constructor constructor) {
|
||||
@ -145,33 +137,19 @@ public class Signature {
|
||||
}
|
||||
|
||||
private void createSignatureForFunN(int numberOfParams, String to, String[] paramTypes) {
|
||||
for (int i = 0; i < numberOfParams; i++) {
|
||||
int j = i + 1;
|
||||
sw.visitFormalTypeParameter("T" + j);
|
||||
// getBounds von Params
|
||||
sw.visitClassBound().visitClassType(paramTypes[i]);
|
||||
sw.visitClassBound().visitEnd();
|
||||
}
|
||||
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
||||
|
||||
sw.visitFormalTypeParameter("R");
|
||||
visitClassBound(to);
|
||||
// TODO: prüfe ob Return-Type = void,
|
||||
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));
|
||||
;
|
||||
sw.visitEnd();
|
||||
|
||||
}
|
||||
|
||||
private void createSignatureForFunN(int numberOfParams) {
|
||||
|
||||
// sw.visitClassBound().visitEnd();
|
||||
for (int i = 0; i < numberOfParams; i++) {
|
||||
int j = i + 1;
|
||||
sw.visitFormalTypeParameter("T" + j);
|
||||
// getBounds von Params
|
||||
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
|
||||
sw.visitClassBound().visitEnd();
|
||||
}
|
||||
defineTypeVariablesForParametersOfFunN(numberOfParams);
|
||||
|
||||
sw.visitFormalTypeParameter("R");
|
||||
// getBounds vom Return-Type
|
||||
@ -179,173 +157,19 @@ public class Signature {
|
||||
sw.visitClassBound().visitEnd();
|
||||
// TODO: prüfe ob Return-Type = void,
|
||||
sw.visitSuperclass().visitClassType(Type.getInternalName(Object.class));
|
||||
;
|
||||
sw.visitEnd();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates signature for a method or constructor with @see
|
||||
* {@link SignatureWriter} Signature looks like: <typevaliables
|
||||
* (K:Ljava/lang/Object "Bounds")>(params L.. OR T.. Or basistape)ReturnType
|
||||
*
|
||||
* @param method method or constructor
|
||||
* @param isConstructor true if constructor
|
||||
*/
|
||||
private void createSignatureForConsOrMethod(Method method, boolean isConstructor) {
|
||||
Iterator<? extends GenericTypeVar> itr = method.getGenerics().iterator();
|
||||
// visits all formal type parameter and visits their bounds <T:...;B:...;...>
|
||||
while (itr.hasNext()) {
|
||||
System.out.println("HAS GENERICS!!");
|
||||
GenericTypeVar g = itr.next();
|
||||
visitTypeVarsAndTheirBounds(g, genericsAndBoundsMethod);
|
||||
}
|
||||
|
||||
// Wenn die RückgabeType eine TPH ist, wird als generic behandelt
|
||||
// z.B: Type = TPH K => wird eine Formal Type Parameter K$ erzeugt und Bound =
|
||||
// Object
|
||||
if (!isConstructor) {
|
||||
String ret = resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature());
|
||||
ArrayList<TPHConstraint> allConsBeforeSimplify = new ArrayList<>();
|
||||
|
||||
Map<TPHConstraint, Set<String>> allConstraints = new HashMap<>();
|
||||
|
||||
if (ret.contains("<")) {
|
||||
allConsBeforeSimplify = getAllConstraints(
|
||||
(RefType) resultSet.resolveType(method.getReturnType()).resolvedType);
|
||||
}
|
||||
|
||||
for (String paramName : methodParamsAndTypes.keySet()) {
|
||||
RefTypeOrTPHOrWildcardOrGeneric t = methodParamsAndTypes.get(paramName);
|
||||
String pT = t.acceptTV(new TypeToSignature());
|
||||
|
||||
if (pT.contains("<"))
|
||||
allConsBeforeSimplify = getAllConstraints((RefType) t);
|
||||
}
|
||||
boolean doSimplify = false;
|
||||
if (!allConsBeforeSimplify.isEmpty()) {
|
||||
addConstraintsToMap(allConstraints, allConsBeforeSimplify);
|
||||
doSimplify = true;
|
||||
}
|
||||
createTypeVars(allConstraints, doSimplify);
|
||||
|
||||
if (!ret.equals("V")) {
|
||||
if (ret.contains(SPECIAL_CHAR) && !ret.contains(SPECIAL_CHAR_FOR_FUN) && !ret.contains("<")) {
|
||||
if (genericsAndBounds.containsKey(ret)) {
|
||||
genericsAndBoundsMethod.put(ret.substring(1), genericsAndBounds.get(ret.substring(1)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
visitParams();
|
||||
if (isConstructor || resultSet.resolveType(method.getReturnType()).resolvedType.acceptTV(new TypeToSignature())
|
||||
.equals("V")) {
|
||||
sw.visitReturnType().visitBaseType('V');
|
||||
} else {
|
||||
RefTypeOrTPHOrWildcardOrGeneric returnType = method.getReturnType();
|
||||
// return type deswegen ist false
|
||||
// doVisitParamsOrReturn(returnType, false);
|
||||
}
|
||||
// sw.visitEnd();
|
||||
}
|
||||
|
||||
private void addConstraintsToMap(Map<TPHConstraint, Set<String>> allConstraints,
|
||||
ArrayList<TPHConstraint> allConsBeforeSimplify) {
|
||||
for (TPHConstraint tphCons : allConsBeforeSimplify) {
|
||||
allConstraints.put(tphCons, null);
|
||||
}
|
||||
}
|
||||
|
||||
private String getEqualTPH(Map<TPHConstraint, Set<String>> methodConstraints2, String tph) {
|
||||
for (TPHConstraint cons : methodConstraints2.keySet()) {
|
||||
if (methodConstraints2.get(cons) != null) {
|
||||
if (methodConstraints2.get(cons).contains(tph)) {
|
||||
return cons.getLeft();
|
||||
}
|
||||
}
|
||||
}
|
||||
return tph;
|
||||
}
|
||||
|
||||
private void createTypeVars(Map<TPHConstraint, Set<String>> allConstraints, boolean doSimplify) {
|
||||
allConstraints.putAll(methodConstraints);
|
||||
|
||||
Map<TPHConstraint, Set<String>> simplifiedConstraints;
|
||||
if (doSimplify) {
|
||||
simplifiedConstraints = Simplify.simplifyContraints(allConstraints);
|
||||
} else {
|
||||
simplifiedConstraints = allConstraints;
|
||||
}
|
||||
|
||||
for (TPHConstraint cons : simplifiedConstraints.keySet()) {
|
||||
// need subst.
|
||||
String sub = cons.getLeft() + SPECIAL_CHAR;
|
||||
if (!genericsAndBoundsMethod.containsKey(sub) && !genericsAndBounds.containsKey(sub)) {
|
||||
sw.visitFormalTypeParameter(sub);
|
||||
String bound = cons.getRight();
|
||||
if (bound.equals(Type.getInternalName(Object.class))) {
|
||||
private void defineTypeVariablesForParametersOfFunN(int numberOfParams) {
|
||||
for (int i = 0; i < numberOfParams; i++) {
|
||||
int j = i + 1;
|
||||
sw.visitFormalTypeParameter("T" + j);
|
||||
// getBounds von Params
|
||||
sw.visitClassBound().visitClassType(Type.getInternalName(Object.class));
|
||||
sw.visitClassBound().visitEnd();
|
||||
genericsAndBoundsMethod.put(sub, bound);
|
||||
} else {
|
||||
String boundName = bound + SPECIAL_CHAR;
|
||||
sw.visitClassBound().visitTypeVariable(boundName);
|
||||
genericsAndBoundsMethod.put(sub, boundName);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private ArrayList<TPHConstraint> getAllConstraints(RefType ref) {
|
||||
final ArrayList<TPHConstraint> res = new ArrayList<>();
|
||||
for (RefTypeOrTPHOrWildcardOrGeneric p : ref.getParaList()) {
|
||||
ResolvedType resType;
|
||||
if (p instanceof WildcardType) {
|
||||
resType = resultSet.resolveType(((WildcardType) p).getInnerType());
|
||||
} else {
|
||||
resType = resultSet.resolveType(p);
|
||||
}
|
||||
|
||||
RefTypeOrTPHOrWildcardOrGeneric resolved = resType.resolvedType;
|
||||
if (resolved instanceof TypePlaceholder) {
|
||||
// resType.getAdditionalGenerics().forEach(ag ->{
|
||||
resultSet.genIns.forEach(ag -> {
|
||||
TPHConstraint constr = new ExtendsConstraint(ag.getLeft().getName(), ag.getRight().getName());
|
||||
if (!contains(res, constr)) {
|
||||
res.add(constr);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (resolved instanceof WildcardType) {
|
||||
WildcardType resWC = (WildcardType) resolved;
|
||||
ResolvedType resType2 = resultSet.resolveType(resWC.getInnerType());
|
||||
if (resType2.resolvedType instanceof TypePlaceholder) {
|
||||
// resType2.getAdditionalGenerics().forEach(ag ->{
|
||||
resultSet.genIns.forEach(ag -> {
|
||||
TPHConstraint constr = new ExtendsConstraint(ag.getLeft().getName(), ag.getRight().getName());
|
||||
if (!contains(res, constr)) {
|
||||
res.add(constr);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
System.out.println("RES GIP === " + res.size());
|
||||
return res;
|
||||
}
|
||||
|
||||
private boolean contains(ArrayList<TPHConstraint> constraints, TPHConstraint constr) {
|
||||
for (int i = 0; i < constraints.size(); ++i) {
|
||||
TPHConstraint p = constraints.get(i);
|
||||
if (constr.getLeft().equals(p.getLeft()) && constr.getRight().equals(p.getRight()))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Visits parameter type or return type with {@link SignatureVisitor} to create
|
||||
* the method signature
|
||||
@ -363,8 +187,7 @@ public class Signature {
|
||||
break;
|
||||
case "GRT":
|
||||
GenericRefType g = (GenericRefType) t;
|
||||
// sv.visitTypeVariable(g.acceptTV(new TypeToSignature()).substring(1));
|
||||
sv.visitTypeVariable(g.acceptTV(new TypeToSignature()));
|
||||
sv.visitTypeVariable(g.acceptTV(new TypeToSignature(constraints)));
|
||||
break;
|
||||
case "TPH":
|
||||
RefTypeOrTPHOrWildcardOrGeneric r = resultSet.resolveType(t).resolvedType;
|
||||
@ -375,13 +198,12 @@ public class Signature {
|
||||
// das braucht man nicht es reicht: sv.visitTypeVariable(r.acceptTV(new
|
||||
// TypeToSignature())
|
||||
//
|
||||
String sig2 = r.acceptTV(new TypeToSignature());
|
||||
String sig2 = r.acceptTV(new TypeToSignature(constraints));
|
||||
if (r instanceof GenericRefType) {
|
||||
sv.visitTypeVariable(sig2);
|
||||
} else if (!(r instanceof TypePlaceholder)) {
|
||||
if (sig2.contains(SPECIAL_CHAR_FOR_FUN)) {
|
||||
System.out.println(" Signature FUN$$: " + r);
|
||||
sv.visitInterface().visitClassType(sig2.substring(1, sig2.length()));
|
||||
sv.visitInterface().visitClassType(sig2.substring(1));
|
||||
} else {
|
||||
// Kann zwischen GenericRefType und RefType nicht unterscheiden
|
||||
// Deswegen wird immer geprüft, ob der Name in Generic Maps liegt
|
||||
@ -405,7 +227,6 @@ public class Signature {
|
||||
} else {
|
||||
toVisit = getEqualTPH(constraints, realName) + SPECIAL_CHAR;
|
||||
}
|
||||
System.out.println(r.getClass() + " Signature TPH: " + r.acceptTV(new TypeToSignature()));
|
||||
}
|
||||
sv.visitTypeVariable(toVisit);
|
||||
}
|
||||
@ -413,41 +234,18 @@ public class Signature {
|
||||
break;
|
||||
|
||||
case "SWC":
|
||||
System.out.println("SWC---Signature");
|
||||
SuperWildcardType swc = (SuperWildcardType) t;
|
||||
String sigInner = swc.getInnerType().acceptTV(new TypeToSignature(constraints));
|
||||
if (swc.getInnerType() instanceof TypePlaceholder) {
|
||||
sv.visitTypeArgument(SUPER_CHAR).visitTypeVariable(sigInner.substring(1, sigInner.length()));
|
||||
} else if (swc.getInnerType() instanceof RefType) {
|
||||
if (sigInner.contains(SPECIAL_CHAR_FOR_FUN)) {
|
||||
sv.visitTypeArgument(SUPER_CHAR).visitInterface().visitClassType(sigInner.substring(1, sigInner.length()));
|
||||
} else {
|
||||
sv.visitTypeArgument(SUPER_CHAR).visitClassType(sigInner.substring(1, sigInner.length()));
|
||||
}
|
||||
} else {
|
||||
sv.visitTypeArgument(SUPER_CHAR).visitTypeVariable(sigInner.substring(1));
|
||||
}
|
||||
int length = sigInner.length();
|
||||
visitWildCard(sv, sigInner, length, swc.getInnerType(), SUPER_CHAR);
|
||||
|
||||
break;
|
||||
|
||||
case "EWC":
|
||||
System.out.println("EWC---Signature");
|
||||
ExtendsWildcardType ewc = (ExtendsWildcardType) t;
|
||||
String esigInner = ewc.getInnerType().acceptTV(new TypeToSignature(constraints));
|
||||
System.out.println(esigInner);
|
||||
if (ewc.getInnerType() instanceof TypePlaceholder) {
|
||||
sv.visitTypeArgument(EXTENDS_CHAR).visitTypeVariable(esigInner.substring(1, esigInner.length()));
|
||||
} else if (ewc.getInnerType() instanceof RefType) {
|
||||
if (esigInner.contains(SPECIAL_CHAR_FOR_FUN)) {
|
||||
sv.visitTypeArgument(EXTENDS_CHAR).visitInterface()
|
||||
.visitClassType(esigInner.substring(1, esigInner.length()));
|
||||
} else {
|
||||
// sv.visitClassType(esigInner.substring(1,esigInner.length()));
|
||||
sv.visitTypeArgument(EXTENDS_CHAR).visitClassType(esigInner.substring(1, esigInner.length()));
|
||||
}
|
||||
} else {
|
||||
sv.visitTypeArgument(EXTENDS_CHAR).visitTypeVariable(esigInner.substring(1));
|
||||
}
|
||||
int lengthEWCSig = esigInner.length();
|
||||
visitWildCard(sv, esigInner, lengthEWCSig, ewc.getInnerType(), EXTENDS_CHAR);
|
||||
|
||||
break;
|
||||
default:
|
||||
@ -457,6 +255,24 @@ public class Signature {
|
||||
}
|
||||
}
|
||||
|
||||
private void visitWildCard(SignatureVisitor sv, String sigInner, int length, RefTypeOrTPHOrWildcardOrGeneric innerType, char superOrExtendsChar) {
|
||||
if (innerType instanceof TypePlaceholder) {
|
||||
sv.visitTypeArgument(superOrExtendsChar).visitTypeVariable(sigInner.substring(1, length));
|
||||
} else if (innerType instanceof RefType) {
|
||||
checkInnerSignatureOfWildCard(sv, sigInner, length, superOrExtendsChar);
|
||||
} else {
|
||||
sv.visitTypeArgument(superOrExtendsChar).visitTypeVariable(sigInner.substring(1));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkInnerSignatureOfWildCard(SignatureVisitor sv, String sigInner, int length, char superOrExtendsChar) {
|
||||
if (sigInner.contains(SPECIAL_CHAR_FOR_FUN)) {
|
||||
sv.visitTypeArgument(superOrExtendsChar).visitInterface().visitClassType(sigInner.substring(1, length));
|
||||
} else {
|
||||
sv.visitTypeArgument(superOrExtendsChar).visitClassType(sigInner.substring(1, length));
|
||||
}
|
||||
}
|
||||
|
||||
private Optional<GenericsGeneratorResult> getEqualTPHFromClassConstraints(List<GenericsGeneratorResult> consClass, String tph) {
|
||||
return consClass.stream()
|
||||
.filter(c -> c.getConstraint().getLeft().equals(tph) || c.getEqualsTPHs().contains(tph))
|
||||
@ -469,38 +285,29 @@ public class Signature {
|
||||
.findFirst().get().getConstraint().getLeft();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isParameterType
|
||||
* @return
|
||||
*/
|
||||
private SignatureVisitor getSignatureVisitor(boolean isParameterType) {
|
||||
SignatureVisitor sv;
|
||||
if (isParameterType) {
|
||||
sv = sw.visitParameterType();
|
||||
} else {
|
||||
sv = sw.visitReturnType();
|
||||
}
|
||||
return sv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates signature for class or interface with {@link SignatureWriter}
|
||||
* Signature looks like: <typevaliables (K:Ljava/lang/Object
|
||||
* "Bounds")>superclass
|
||||
*/
|
||||
private void createSignatureForClassOrInterface() {
|
||||
Iterator<GenericTypeVar> itr = classOrInterface.getGenerics().iterator();
|
||||
|
||||
while (itr.hasNext()) {
|
||||
GenericTypeVar g = itr.next();
|
||||
visitTypeVarsAndTheirBounds(g, genericsAndBounds);
|
||||
}
|
||||
public String createSignatureForClassOrInterface() {
|
||||
defineTypeVariablesForClassOrInterface();
|
||||
|
||||
defineGenericsFromConstraints(consClass,genericsAndBounds);
|
||||
|
||||
String sClass = classOrInterface.getSuperClass().acceptTV(new TypeToSignature());
|
||||
sw.visitSuperclass().visitClassType(sClass.substring(1, sClass.length() - 1));
|
||||
sw.visitEnd();
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
private void defineTypeVariablesForClassOrInterface() {
|
||||
Iterator<GenericTypeVar> itr = classOrInterface.getGenerics().iterator();
|
||||
|
||||
while (itr.hasNext()) {
|
||||
GenericTypeVar g = itr.next();
|
||||
visitTypeVarsAndTheirBounds(g, genericsAndBounds);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -553,7 +360,6 @@ public class Signature {
|
||||
while (bItr.hasNext()) {
|
||||
RefTypeOrTPHOrWildcardOrGeneric b = bItr.next();
|
||||
String boundDesc = b.acceptTV(new TypeToDescriptor());
|
||||
// System.out.println("GetBounds: " + boundDesc);
|
||||
// Ensure that <...> extends java.lang.Object OR ...
|
||||
if (b instanceof GenericRefType) {
|
||||
sw.visitClassBound().visitTypeVariable(boundDesc);
|
||||
@ -562,11 +368,6 @@ public class Signature {
|
||||
}
|
||||
genAndBounds.put(g.getName(), boundDesc);
|
||||
}
|
||||
// sw.visitClassBound().visitEnd();
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return sw.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -5,8 +5,7 @@ import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.exceptions.NotImplementedException;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
|
@ -1,64 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
|
||||
/**
|
||||
* The class SimplifyResult represents the results of the simplify algorithm.
|
||||
* This class contains all constraints and all type placeholders of a class. The type placeholders
|
||||
* are represented by their names.
|
||||
* The simplify results of each method of a class are also contained in this class.
|
||||
*
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class SimplifyResult {
|
||||
private List<TPHConstraint> classConstraints;
|
||||
private List<String> tphsClass;
|
||||
private final List<SimplifyResultMethod> simplifyResultForMethod = new ArrayList<>();
|
||||
|
||||
public SimplifyResult(List<TPHConstraint> classConstraints, List<String> tphsClass) {
|
||||
this.classConstraints = classConstraints;
|
||||
this.tphsClass = tphsClass;
|
||||
}
|
||||
|
||||
public SimplifyResult() {
|
||||
}
|
||||
|
||||
public List<TPHConstraint> getClassConstraints() {
|
||||
return classConstraints;
|
||||
}
|
||||
|
||||
public List<SimplifyResultMethod> getSimplifyResultForMethod() {
|
||||
return simplifyResultForMethod;
|
||||
}
|
||||
|
||||
public List<String> getTphsClass() {
|
||||
return tphsClass==null?new ArrayList<>():tphsClass;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param classConstraints the classConstraints to set
|
||||
*/
|
||||
public void setClassConstraints(List<TPHConstraint> classConstraints) {
|
||||
this.classConstraints = classConstraints;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tphsClass the tphsClass to set
|
||||
*/
|
||||
public void setTphsClass(List<String> tphsClass) {
|
||||
this.tphsClass = tphsClass;
|
||||
}
|
||||
|
||||
public Map<TPHConstraint, Set<String>> getMethodConstraintsByID(String id){
|
||||
return simplifyResultForMethod.stream().filter(sr->sr.getMethodID().equals(id)).findAny().get().getConastraintsAndEqualTPHs();
|
||||
}
|
||||
}
|
@ -1,48 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
|
||||
|
||||
/**
|
||||
* The simplify results of a class
|
||||
*
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class SimplifyResultClass {
|
||||
private final String className;
|
||||
private SimplifyResult simplifyResults;
|
||||
|
||||
/**
|
||||
* @param className
|
||||
*/
|
||||
public SimplifyResultClass(String className) {
|
||||
this.className = className;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param className
|
||||
* @param simplifyResults
|
||||
*/
|
||||
public SimplifyResultClass(String className, SimplifyResult simplifyResults) {
|
||||
this.className = className;
|
||||
this.simplifyResults = simplifyResults;
|
||||
}
|
||||
|
||||
public String getClassName() {
|
||||
return className;
|
||||
}
|
||||
|
||||
public SimplifyResult getSimplifyResults() {
|
||||
return simplifyResults;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param simplifyResults the simplifyResults to set
|
||||
*/
|
||||
public void setSimplifyResults(SimplifyResult simplifyResults) {
|
||||
this.simplifyResults = simplifyResults;
|
||||
}
|
||||
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
|
||||
/**
|
||||
* The simplify results of a methed
|
||||
*
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class SimplifyResultMethod {
|
||||
|
||||
private final String methodID;
|
||||
private final Map<TPHConstraint, Set<String>> conastraintsAndEqualTPHs;
|
||||
|
||||
|
||||
public SimplifyResultMethod(String methodName, Map<TPHConstraint, Set<String>> conastraintsAndEqualTPHs) {
|
||||
this.methodID = methodName;
|
||||
this.conastraintsAndEqualTPHs = conastraintsAndEqualTPHs;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the methodName
|
||||
*/
|
||||
public String getMethodID() {
|
||||
return methodID;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return the conastraintsAndEqualTPHs
|
||||
*/
|
||||
public Map<TPHConstraint, Set<String>> getConastraintsAndEqualTPHs() {
|
||||
return conastraintsAndEqualTPHs;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package de.dhbwstuttgart.bytecode.simplifyRes;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.GenericTypeVar;
|
||||
import de.dhbwstuttgart.syntaxtree.type.GenericRefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
|
||||
/**
|
||||
* @author fayez
|
||||
*
|
||||
*/
|
||||
public class TypeVariableFinder {
|
||||
private ClassOrInterface classOrInterface;
|
||||
private Map<String, String> genericsAndBounds;
|
||||
private List<TPHConstraint> consClass;
|
||||
|
||||
public TypeVariableFinder(ClassOrInterface classOrInterface, Map<String, String> genericsAndBounds,
|
||||
List<TPHConstraint> consClass) {
|
||||
this.classOrInterface = classOrInterface;
|
||||
this.genericsAndBounds = genericsAndBounds;
|
||||
this.consClass = consClass;
|
||||
}
|
||||
|
||||
public void findTV() {
|
||||
Iterator<GenericTypeVar> itr = classOrInterface.getGenerics().iterator();
|
||||
|
||||
while(itr.hasNext()) {
|
||||
GenericTypeVar g = itr.next();
|
||||
getBoundsOfTypeVar(g,genericsAndBounds);
|
||||
}
|
||||
|
||||
if(!consClass.isEmpty()) {
|
||||
ArrayList<String> types = new ArrayList<>();
|
||||
ArrayList<String> superTypes = new ArrayList<>();
|
||||
|
||||
for(TPHConstraint cons : consClass) {
|
||||
types.add(cons.getLeft());
|
||||
superTypes.add(cons.getRight());
|
||||
}
|
||||
|
||||
for(TPHConstraint cons : consClass) {
|
||||
String t = cons.getLeft()+"$";
|
||||
String bound = cons.getRight();
|
||||
if(!bound.equals(Type.getInternalName(Object.class)))
|
||||
bound += "$";
|
||||
genericsAndBounds.put(t, bound);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get bounds of type variable
|
||||
* @param g type variable
|
||||
* @param genAndBounds
|
||||
*/
|
||||
private void getBoundsOfTypeVar(GenericTypeVar g, Map<String, String> genAndBounds) {
|
||||
|
||||
Iterator<? extends RefTypeOrTPHOrWildcardOrGeneric> bItr = g.getBounds().iterator();
|
||||
while(bItr.hasNext()) {
|
||||
RefTypeOrTPHOrWildcardOrGeneric b =bItr.next();
|
||||
String boundDesc = b.acceptTV(new TypeToDescriptor());
|
||||
// Ensure that <...> extends java.lang.Object OR ...
|
||||
genAndBounds.put(g.getName(), boundDesc);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint.Relation;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.ConstraintsWithSameLeftSide;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.ConstraintsWithSameLeftSide;
|
||||
|
||||
public class ConstraintsFinder {
|
||||
private List<TPHConstraint> allConstaints;
|
||||
|
@ -7,7 +7,7 @@ import java.util.Map;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.NameReplacementResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.NameReplacementResult;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.NameGenerator;
|
||||
|
||||
public class NameReplacer {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,23 +3,18 @@ package de.dhbwstuttgart.core;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.BytecodeGen;
|
||||
import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.SimplifyResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GeneratedGenericsFinder;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.genericsGenerator.GeneratedGenericsFinder;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.environment.CompilationEnvironment;
|
||||
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.parser.scope.GenericsRegistry;
|
||||
import de.dhbwstuttgart.parser.SyntaxTreeGenerator.SyntaxTreeGenerator;
|
||||
import de.dhbwstuttgart.parser.antlr.Java8Parser.CompilationUnitContext;
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassRegistry;
|
||||
import de.dhbwstuttgart.syntaxtree.ClassOrInterface;
|
||||
import de.dhbwstuttgart.syntaxtree.ParameterList;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.ASTFactory;
|
||||
import de.dhbwstuttgart.syntaxtree.factory.UnifyTypeFactory;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPHOrWildcardOrGeneric;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.visual.ASTTypePrinter;
|
||||
import de.dhbwstuttgart.typeinference.constraints.Constraint;
|
||||
@ -31,7 +26,6 @@ import de.dhbwstuttgart.typeinference.unify.RuleSet;
|
||||
import de.dhbwstuttgart.typeinference.unify.TypeUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.distributeVariance;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
@ -46,15 +40,10 @@ import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Writer;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.antlr.v4.parse.ANTLRParser.throwsSpec_return;
|
||||
import org.apache.commons.io.output.NullOutputStream;
|
||||
//import org.apache.commons.io.output.NullOutputStream;
|
||||
|
||||
public class JavaTXCompiler {
|
||||
@ -66,13 +55,6 @@ public class JavaTXCompiler {
|
||||
Boolean log = true; //gibt an ob ein Log-File nach System.getProperty("user.dir")+"src/test/java/logFiles" geschrieben werden soll?
|
||||
public volatile UnifyTaskModel usedTasks = new UnifyTaskModel();
|
||||
|
||||
/**
|
||||
* Äußerste Liste der Source-Files.
|
||||
* Danach Liste der Klassen in Source File.
|
||||
* Danach Map Klassenname
|
||||
*/
|
||||
private List<List<HashMap<String, SimplifyResult>>> simplifyResultsSF = new ArrayList<>();
|
||||
|
||||
public JavaTXCompiler(File sourceFile) throws IOException, ClassNotFoundException {
|
||||
this(Arrays.asList(sourceFile));
|
||||
INSTANCE = this;
|
||||
|
@ -1,37 +1,20 @@
|
||||
package de.dhbwstuttgart.typedeployment;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.Exception.BytecodeGeneratorError;
|
||||
import de.dhbwstuttgart.bytecode.constraint.TPHConstraint;
|
||||
import de.dhbwstuttgart.bytecode.descriptor.TypeToDescriptor;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResult;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericsGeneratorResultForClass;
|
||||
import de.dhbwstuttgart.bytecode.utilities.MethodUtility;
|
||||
import de.dhbwstuttgart.bytecode.utilities.Resolver;
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.syntaxtree.*;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.NewArray;
|
||||
import de.dhbwstuttgart.syntaxtree.type.*;
|
||||
import de.dhbwstuttgart.typeinference.result.*;
|
||||
|
||||
import org.antlr.v4.parse.ANTLRParser.action_return;
|
||||
import org.antlr.v4.parse.ANTLRParser.block_return;
|
||||
import org.antlr.v4.parse.ANTLRParser.labeledAlt_return;
|
||||
import org.antlr.v4.parse.ANTLRParser.parserRule_return;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.stringtemplate.v4.compiler.STParser.ifstat_return;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import javax.print.DocFlavor.STRING;
|
||||
import javax.security.auth.kerberos.KerberosKey;
|
||||
|
||||
/**
|
||||
* TODO:
|
||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
||||
import de.dhbwstuttgart.bytecode.simplifyRes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.bytecode.genericsGeneratorTypes.GenericGenratorResultForSourceFile;
|
||||
import de.dhbwstuttgart.core.JavaTXCompiler;
|
||||
import de.dhbwstuttgart.typeinference.result.ResultSet;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user