Skip to content

Commit

Permalink
Fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 17, 2024
1 parent 5f9833d commit 0a11281
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,10 @@ else if(arg.charAt(i) == '\n' || arg.charAt(i) == '{') {
}
inferredArgumentTypes.add(UMLType.extractTypeObject(type));
}
else if(arg.endsWith(".INSTANCE") || arg.endsWith(".instance()") || arg.endsWith(".getInstance()")) {
String type = arg.substring(0, arg.lastIndexOf("."));
inferredArgumentTypes.add(UMLType.extractTypeObject(type));
}
else if(indexOfOpeningParenthesis == 0 && arg.contains(")") && !arg.contains(JAVA.LAMBDA_ARROW) && !arg.contains(JAVA.METHOD_REFERENCE) && arg.indexOf(")") < arg.length()) {
String cast = arg.substring(indexOfOpeningParenthesis + 1, arg.indexOf(")"));
if(cast.charAt(0) != '(') {
Expand Down Expand Up @@ -465,6 +469,19 @@ private static String handleNumber(String argument) {
Double.parseDouble(argument);
return "double";
} catch (NumberFormatException e) {}
/*if(argument.contains(".")) {
String beforeDot = argument.substring(0, argument.lastIndexOf("."));
String afterDot = argument.substring(argument.lastIndexOf(".") + 1, argument.length());
int counter = 0;
for(int i=0; i<afterDot.length(); i++) {
if(Character.isUpperCase(afterDot.charAt(i)) || afterDot.charAt(i) == '_') {
counter++;
}
}
if(counter == afterDot.length()) {
return beforeDot;
}
}*/
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2817,7 +2817,8 @@ else if(objectCreation1.inlinedStatementBecomesAdditionalArgument(creationCoveri
replacementInfo.addReplacement(replacement);
return replacementInfo.getReplacements();
}
else if(objectCreation1.compatibleName(creationCoveringTheEntireStatement2) && objectCreation1.equalArguments(creationCoveringTheEntireStatement2) && objectCreation1.identicalExpression(creationCoveringTheEntireStatement2)) {
else if(objectCreation1.compatibleName(creationCoveringTheEntireStatement2) && objectCreation1.equalArguments(creationCoveringTheEntireStatement2) && objectCreation1.identicalExpression(creationCoveringTheEntireStatement2) &&
variableDeclarations1.size() == variableDeclarations2.size()) {
Replacement replacement = new ObjectCreationReplacement(objectCreation1.actualString(),
creationCoveringTheEntireStatement2.actualString(), (ObjectCreation)objectCreation1, creationCoveringTheEntireStatement2, ReplacementType.CLASS_INSTANCE_CREATION);
replacementInfo.addReplacement(replacement);
Expand Down

0 comments on commit 0a11281

Please sign in to comment.