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

This commit is contained in:
pl@gohorb.ba-horb.de 2021-02-07 09:47:25 +01:00
parent 5b7fec660d
commit 5fb2d57d3b

View File

@ -287,14 +287,17 @@ public class TPHExtractor extends AbstractASTWalker {
if (nameToMeth.keySet().contains(fieldOrMethName = methodCall.name) //Method-call of a method in the actuial Sourcefile if (nameToMeth.keySet().contains(fieldOrMethName = methodCall.name) //Method-call of a method in the actuial Sourcefile
|| (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)
|| (((ExpressionReceiver)methodCall.receiver).expr instanceof LocalVar) &&
nameToField.keySet().contains(fieldOrMethName = ((LocalVar)((ExpressionReceiver)methodCall.receiver).expr).name)
)
) )
) )
{ {
Iterator<RefTypeOrTPHOrWildcardOrGeneric> paraIt = Iterator<RefTypeOrTPHOrWildcardOrGeneric> paraIt =
methodCall.name.equals("apply") methodCall.name.equals("apply")
? (FuNTYPE)(resultSet.resolveType((nameToField.get(fieldOrMethName))).resolvedType).GETARGTYPES ? ((RefType)(resultSet.resolveType((nameToField.get(fieldOrMethName))).resolvedType)).getParaList().iterator()
: nameToMeth.get(methodCall.name) : nameToMeth.get(methodCall.name)
.getParameterList() .getParameterList()
.getFormalparalist() .getFormalparalist()
@ -305,7 +308,7 @@ public class TPHExtractor extends AbstractASTWalker {
.getArguments() .getArguments()
.forEach(x -> { .forEach(x -> {
RefTypeOrTPHOrWildcardOrGeneric left = resultSet.resolveType(x.getType()).resolvedType; RefTypeOrTPHOrWildcardOrGeneric left = resultSet.resolveType(x.getType()).resolvedType;
RefTypeOrTPHOrWildcardOrGeneric right = resultSet.resolveType(paraIt.next().getType()).resolvedType; RefTypeOrTPHOrWildcardOrGeneric right = resultSet.resolveType(paraIt.next()).resolvedType;
if (left instanceof TypePlaceholder && methodAndTph.getTphs().contains(((TypePlaceholder)left).getName())) { if (left instanceof TypePlaceholder && methodAndTph.getTphs().contains(((TypePlaceholder)left).getName())) {
if (right instanceof TypePlaceholder) { if (right instanceof TypePlaceholder) {
methodAndTph.addPair(allPairs.stream().filter( methodAndTph.addPair(allPairs.stream().filter(