Skip to content

Commit

Permalink
Fix for #828
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 18, 2024
1 parent 2dd85df commit 1e8f12e
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,13 @@ else if((parentFieldDeclarationMap != null && parentFieldDeclarationMap.contains
}
}
else {
inferredArgumentTypes.add(null);
String numberType = handleNumber(arg);
if(numberType != null) {
inferredArgumentTypes.add(UMLType.extractTypeObject(numberType));
}
else {
inferredArgumentTypes.add(null);
}
}
}
int i=0;
Expand Down Expand Up @@ -442,6 +448,26 @@ private static boolean exactlyMatchingArgumentType(UMLType parameterType, UMLTyp
return parameterType.getClassType().equals(argumentType.toString()) || parameterType.toString().equals(argumentType.toString());
}

private static String handleNumber(String argument) {
try {
Integer.parseInt(argument);
return "int";
} catch (NumberFormatException e) {}
try {
Long.parseLong(argument);
return "long";
} catch (NumberFormatException e) {}
try {
Float.parseFloat(argument);
return "float";
} catch (NumberFormatException e) {}
try {
Double.parseDouble(argument);
return "double";
} catch (NumberFormatException e) {}
return null;
}

public static boolean compatibleTypes(UMLParameter parameter, UMLType type, UMLAbstractClassDiff classDiff, UMLModelDiff modelDiff) {
String type1 = parameter.getType().toString();
String type2 = type.toString();
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/gr/uom/java/xmi/diff/UMLModelDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -2732,7 +2732,9 @@ private List<Refactoring> getSplitClassRefactorings(List<RenamePackageRefactorin
detectSubRefactorings(renameDiff, renameDiff.getRenamedClass(), refactoring.getRefactoringType());
for(UMLOperationBodyMapper mapper : renameDiff.getOperationBodyMapperList()) {
MoveOperationRefactoring move = new MoveOperationRefactoring(mapper);
Set<Refactoring> mapperRefactorings = mapper.getRefactorings();
refactorings.add(move);
refactorings.addAll(mapperRefactorings);
}
}
if(!classSplitDiff.samePackage()) {
Expand Down

0 comments on commit 1e8f12e

Please sign in to comment.