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

This commit is contained in:
pl@gohorb.ba-horb.de 2021-02-06 09:51:42 +01:00
parent 5980f1c7b8
commit 5b7fec660d

View File

@ -62,7 +62,7 @@ public class TPHExtractor extends AbstractASTWalker {
/* /*
* ordnet den Methodennamen ihre jeweiligen Methodenrespraesentationen der abstrakte Syntax in der jeweiligen aktuellen Klasse zu * ordnet den Methodennamen ihre jeweiligen Methodenrespraesentationen der abstrakte Syntax in der jeweiligen aktuellen Klasse zu
*/ */
public HashMap<String,Expression> nameToField; public HashMap<String,RefTypeOrTPHOrWildcardOrGeneric> nameToField;
public final HashMap<String, Boolean> allTPHS = new HashMap<>(); public final HashMap<String, Boolean> allTPHS = new HashMap<>();
public final List<String> tphsClass = new ArrayList<>(); public final List<String> tphsClass = new ArrayList<>();
MethodAndTPH methodAndTph; MethodAndTPH methodAndTph;
@ -233,7 +233,8 @@ public class TPHExtractor extends AbstractASTWalker {
.stream() .stream()
.filter(s -> s instanceof Assign) .filter(s -> s instanceof Assign)
.forEach(as -> .forEach(as ->
this.nameToField.put(((AssignToField)(((Assign)as).lefSide)).field.fieldVarName, ((Assign)as).rightSide)); this.nameToField.put(((AssignToField)(((Assign)as).lefSide)).field.fieldVarName,
((AssignToField)(((Assign)as).lefSide)).getType())) ;
} }
this.nameToMeth = new HashMap<>(); this.nameToMeth = new HashMap<>();
@ -287,14 +288,19 @@ public class TPHExtractor extends AbstractASTWalker {
|| (methodCall.name.equals("apply") && || (methodCall.name.equals("apply") &&
(methodCall.receiver instanceof ExpressionReceiver) && (methodCall.receiver instanceof ExpressionReceiver) &&
(((ExpressionReceiver)methodCall.receiver).expr instanceof FieldVar) && (((ExpressionReceiver)methodCall.receiver).expr instanceof FieldVar) &&
nameToField.keySet().contains(fieldOrMethName=((FieldVar)((ExpressionReceiver)methodCall.receiver).expr).fieldVarName) nameToField.keySet().contains(fieldOrMethName = ((FieldVar)((ExpressionReceiver)methodCall.receiver).expr).fieldVarName)
) )
) )
{ {
Iterator<FormalParameter> paraIt = Iterator<RefTypeOrTPHOrWildcardOrGeneric> paraIt =
methodCall.name.equals("apply") methodCall.name.equals("apply")
? ((LambdaExpression)nameToField.get(fieldOrMethName)).params.iterator() ? (FuNTYPE)(resultSet.resolveType((nameToField.get(fieldOrMethName))).resolvedType).GETARGTYPES
: nameToMeth.get(methodCall.name).getParameterList().iterator(); : nameToMeth.get(methodCall.name)
.getParameterList()
.getFormalparalist()
.stream()
.map(p -> p.getType())
.iterator();
methodCall.getArgumentList() methodCall.getArgumentList()
.getArguments() .getArguments()
.forEach(x -> { .forEach(x -> {