modified: src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java

modified:   src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java
	modified:   src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java
	modified:   src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java
Neue Methode addTph

	modified:   src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java
Methodcall-Steatements mit Void als Returntyp
This commit is contained in:
pl@gohorb.ba-horb.de 2021-04-09 09:15:10 +02:00
parent c8d4301e5e
commit 3363037854
5 changed files with 12 additions and 7 deletions

View File

@ -92,7 +92,7 @@ public class TPHExtractor extends AbstractASTWalker {
if (inMethod && !tphsClass.contains(tphName)) { if (inMethod && !tphsClass.contains(tphName)) {
ArrayList<String> tphs = null; ArrayList<String> tphs = null;
if (!(tphs = methodAndTph.getTphs()).contains(tphName)) { if (!(tphs = methodAndTph.getTphs()).contains(tphName)) {
tphs.add(tphName); methodAndTph.addTph(tphName);
} }
if (inLocalOrParamOrReturn) { if (inLocalOrParamOrReturn) {
if (!(tphs = methodAndTph.getLocalTphs()).contains(tphName)) { if (!(tphs = methodAndTph.getLocalTphs()).contains(tphName)) {
@ -173,7 +173,7 @@ public class TPHExtractor extends AbstractASTWalker {
public void visit(GenericRefType genericRefType) { public void visit(GenericRefType genericRefType) {
String name = genericRefType.getParsedName(); String name = genericRefType.getParsedName();
if (inMethod) { if (inMethod) {
methodAndTph.getTphs().add(name); methodAndTph.addTph(name);
if (inLocalOrParamOrReturn) if (inLocalOrParamOrReturn)
methodAndTph.getLocalTphs().add(name); methodAndTph.getLocalTphs().add(name);
}else { }else {

View File

@ -169,7 +169,7 @@ public class GeneratedGenericsFinder implements ASTVisitor {
if(ggResult != null) { //Hinzufuegen von Fayez ggResult if(ggResult != null) { //Hinzufuegen von Fayez ggResult
//generatedGenericsForSF.addGenericGeneratorResultClass(ggResult); generatedGenericsForSF.addGenericGeneratorResultClass(ggResult);
} }
// Fayez Ansatz Ende // Fayez Ansatz Ende
//*/ //*/
@ -198,7 +198,7 @@ public class GeneratedGenericsFinder implements ASTVisitor {
ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM); ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM);
if(ggResultAlternative != null) {//hinzufuegen von Alis ggResult if(ggResultAlternative != null) {//hinzufuegen von Alis ggResult
generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative); //generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative);
System.out.println(generatedGenericsForSF); System.out.println(generatedGenericsForSF);
} }
System.out.println(ggResultAlternative); System.out.println(ggResultAlternative);

View File

@ -648,7 +648,7 @@ public class FamilyOfGeneratedGenerics {
); );
if (containedVars.stream().filter(v -> tcOfCs.contains(new TPHConstraint(key, v, Relation.EXTENDS))) if (containedVars.stream().filter(v -> tcOfCs.contains(new TPHConstraint(key, v, Relation.EXTENDS)))
.count() > 0) { .count() > 0) {
//tempSet2.add(pairExtends2); tempSet2.add(pairExtends2);
} }
if (posOfTphs.containsKey(key)) { if (posOfTphs.containsKey(key)) {
if (posOfTphs.get(key).contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) { if (posOfTphs.get(key).contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) {

View File

@ -28,6 +28,10 @@ public class MethodAndTPH {
this.constraints = constraints; this.constraints = constraints;
} }
public void addTph(String tph) {
tphs.add(tph);
}
public ArrayList<String> getTphs() { public ArrayList<String> getTphs() {
return tphs; return tphs;
} }

View File

@ -213,7 +213,8 @@ public class StatementGenerator {
ArrayList<RefTypeOrTPHOrWildcardOrGeneric> argTypes = argumentList.getArguments().stream() ArrayList<RefTypeOrTPHOrWildcardOrGeneric> argTypes = argumentList.getArguments().stream()
.map(x -> TypePlaceholder.fresh(methodInvocationContext.getStart())) .map(x -> TypePlaceholder.fresh(methodInvocationContext.getStart()))
.collect(Collectors.toCollection(ArrayList::new)); .collect(Collectors.toCollection(ArrayList::new));
MethodCall ret = new MethodCall(TypePlaceholder.fresh(methodInvocationContext.getStart()), MethodCall ret = new MethodCall(//new Void(new NullToken()),
TypePlaceholder.fresh(methodInvocationContext.getStart()),
getReceiver(receiver), name, argumentList, TypePlaceholder.fresh(methodInvocationContext.getStart()), getReceiver(receiver), name, argumentList, TypePlaceholder.fresh(methodInvocationContext.getStart()),
argTypes, methodInvocationContext.getStart()); argTypes, methodInvocationContext.getStart());
return ret; return ret;