Skip to content

Commit

Permalink
handle 'should'
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Jul 26, 2023
1 parent b69ad96 commit acfc00b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ private LvtAssignmentSuggester() {}
return suggested;
}

suggested = suggestNameFromIsOrHas(methodName, insn);
suggested = suggestNameFromVerbBoolean(methodName, insn);
if (suggested != null) {
return suggested;
}
Expand Down Expand Up @@ -110,7 +110,7 @@ public static String suggestNameFromRecord(final String methodName) {
}
}

private static @Nullable String suggestNameFromIsOrHas(final String methodName, final MethodInsnNode insn) {
private static @Nullable String suggestNameFromVerbBoolean(final String methodName, final MethodInsnNode insn) {
if (insn.desc == null || !insn.desc.endsWith("Z")) { // only handle methods that return booleans
return null;
}
Expand All @@ -122,6 +122,8 @@ public static String suggestNameFromRecord(final String methodName) {
prefix = "has";
} else if (!"can".equals(methodName) && methodName.startsWith("can")) {
prefix = "can";
} else if (!"should".equals(methodName) && methodName.startsWith("should")) {
prefix = "should";
} else {
return null;
}
Expand Down

0 comments on commit acfc00b

Please sign in to comment.