diff --git a/src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java b/src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java index 785c65e..c05cd7f 100644 --- a/src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java +++ b/src/main/java/io/papermc/codebook/lvt/LvtAssignmentSuggester.java @@ -491,7 +491,7 @@ private static boolean isStringAllUppercase(final String input) { // I think it's best to only work with primitive types here, as other types should already have names // and this dramatically cuts down on the number of methods analyzed because we aren't filtering by // method name - if (!(method.descriptor().getReturnType() instanceof PrimitiveType)) { + if (!(method.descriptor().getReturnType() instanceof PrimitiveType) || !method.params().isEmpty()) { return null; } int opcodeIndex = 0; @@ -500,15 +500,21 @@ private static boolean isStringAllUppercase(final String input) { continue; } if (opcodeIndex == OPCODES_IN_ORDER.length) { - return null; + break; // matched the correct order } if (OPCODES_IN_ORDER[opcodeIndex].test(methodInsn.getOpcode())) { opcodeIndex++; + } else { + return null; } } - if (opcodeIndex != OPCODES_IN_ORDER.length) { - return null; + if (method.isStatic()) { // limit static matches + if ("java/lang/System".equals(insn.owner) && "currentTimeMillis".equals(insn.name)) { + return "currentTimeMillis"; + } + } else { + return method.name(); } - return method.name(); + return null; } }