Improved type inference for arguments that concatenate string literals
with non string literals
@@ -125,6 +125,13 @@ public class OperationInvocation extends AbstractCall {
else if(arg.startsWith("\"") && arg.endsWith("\"")) {
inferredArgumentTypes.add(UMLType.extractTypeObject("String"));
}
+ else if(arg.contains("+") && !arg.contains("++") && !UMLOperationBodyMapper.containsMethodSignatureOfAnonymousClass(arg)) {
+ String SPLIT_CONCAT_STRING_PATTERN = "(\\s)*(\\+)(\\s)*";
+ String[] tokens = arg.split(SPLIT_CONCAT_STRING_PATTERN);
+ if(tokens[0].startsWith("\"") && tokens[0].endsWith("\"")) {
+ inferredArgumentTypes.add(UMLType.extractTypeObject("String"));
+ }
+ }
else if(arg.startsWith("\'") && arg.endsWith("\'")) {
inferredArgumentTypes.add(UMLType.extractTypeObject("char"));
}
@@ -153,6 +160,9 @@ public class OperationInvocation extends AbstractCall {
}
inferredArgumentTypes.add(UMLType.extractTypeObject(type));
}
+ else if(arg.endsWith(".getClassLoader()")) {
+ inferredArgumentTypes.add(UMLType.extractTypeObject("ClassLoader"));
+ }
else {
inferredArgumentTypes.add(null);
}
