From 3363037854a3fc2a05e01097c2feba23ee75a031 Mon Sep 17 00:00:00 2001 From: "pl@gohorb.ba-horb.de" Date: Fri, 9 Apr 2021 09:15:10 +0200 Subject: [PATCH] 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 --- src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java | 4 ++-- .../bytecode/genericsGenerator/GeneratedGenericsFinder.java | 4 ++-- .../bytecode/insertGenerics/FamilyOfGeneratedGenerics.java | 2 +- .../de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java | 6 +++++- .../parser/SyntaxTreeGenerator/StatementGenerator.java | 3 ++- 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java b/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java index 2db52ec3..e4f6315e 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/TPHExtractor.java @@ -92,7 +92,7 @@ public class TPHExtractor extends AbstractASTWalker { if (inMethod && !tphsClass.contains(tphName)) { ArrayList tphs = null; if (!(tphs = methodAndTph.getTphs()).contains(tphName)) { - tphs.add(tphName); + methodAndTph.addTph(tphName); } if (inLocalOrParamOrReturn) { if (!(tphs = methodAndTph.getLocalTphs()).contains(tphName)) { @@ -173,7 +173,7 @@ public class TPHExtractor extends AbstractASTWalker { public void visit(GenericRefType genericRefType) { String name = genericRefType.getParsedName(); if (inMethod) { - methodAndTph.getTphs().add(name); + methodAndTph.addTph(name); if (inLocalOrParamOrReturn) methodAndTph.getLocalTphs().add(name); }else { diff --git a/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java b/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java index 930ba3e3..e25958d1 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/genericsGenerator/GeneratedGenericsFinder.java @@ -169,7 +169,7 @@ public class GeneratedGenericsFinder implements ASTVisitor { if(ggResult != null) { //Hinzufuegen von Fayez ggResult - //generatedGenericsForSF.addGenericGeneratorResultClass(ggResult); + generatedGenericsForSF.addGenericGeneratorResultClass(ggResult); } // Fayez Ansatz Ende //*/ @@ -198,7 +198,7 @@ public class GeneratedGenericsFinder implements ASTVisitor { ggResultAlternative = new GenericsGeneratorResultForClass(className, listOfClassCons, ggRfaM); if(ggResultAlternative != null) {//hinzufuegen von Alis ggResult - generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative); + //generatedGenericsForSF.addGenericGeneratorResultClass(ggResultAlternative); System.out.println(generatedGenericsForSF); } System.out.println(ggResultAlternative); diff --git a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java index 33e241e7..f99dddad 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/insertGenerics/FamilyOfGeneratedGenerics.java @@ -648,7 +648,7 @@ public class FamilyOfGeneratedGenerics { ); if (containedVars.stream().filter(v -> tcOfCs.contains(new TPHConstraint(key, v, Relation.EXTENDS))) .count() > 0) { - //tempSet2.add(pairExtends2); + tempSet2.add(pairExtends2); } if (posOfTphs.containsKey(key)) { if (posOfTphs.get(key).contains(new PairTphMethod<>(PositionFinder.Position.METHOD, methodAndTPH.getId()))) { diff --git a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java index c5a93f4f..caaad1be 100644 --- a/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java +++ b/src/main/java/de/dhbwstuttgart/bytecode/utilities/MethodAndTPH.java @@ -27,7 +27,11 @@ public class MethodAndTPH { this.id = name; this.constraints = constraints; } - + + public void addTph(String tph) { + tphs.add(tph); + } + public ArrayList getTphs() { return tphs; } diff --git a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java index c4625a7a..1936b5d2 100644 --- a/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java +++ b/src/main/java/de/dhbwstuttgart/parser/SyntaxTreeGenerator/StatementGenerator.java @@ -213,7 +213,8 @@ public class StatementGenerator { ArrayList argTypes = argumentList.getArguments().stream() .map(x -> TypePlaceholder.fresh(methodInvocationContext.getStart())) .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()), argTypes, methodInvocationContext.getStart()); return ret;