Improved type inference from arguments with cast expressions
Case study:
adaptResult((BuildResult)result,startTime,endTime);
adaptResult((Throwable)result,startTime,endTime);
@@ -292,6 +292,10 @@ public class OperationInvocation extends AbstractCall {
}
inferredArgumentTypes.add(UMLType.extractTypeObject(type));
}
+ else if(indexOfOpeningParenthesis == 0 && arg.contains(")") && !arg.contains("->") && arg.indexOf(")") < arg.length()) {
+ String cast = arg.substring(indexOfOpeningParenthesis + 1, arg.indexOf(")"));
+ inferredArgumentTypes.add(UMLType.extractTypeObject(cast));
+ }
else if(arg.endsWith(".getClassLoader()")) {
inferredArgumentTypes.add(UMLType.extractTypeObject("ClassLoader"));
}
