Skip to content

Commit 2042d29

Browse files
committed
Fix issues with opcodes <= 0
1 parent 51c47ae commit 2042d29

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/main/java/com/monits/linters/InstanceStateDetector.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,12 @@ private String getBundleKeyForMethodCall(@Nonnull final MethodInsnNode instructi
334334
while (expectedArgs > 0) {
335335
node = node.getPrevious();
336336

337-
if (node.getOpcode() > 0 && node.getOpcode() <= 0x2d) {
337+
// NOP + unknown opcodes (I get fed -1)
338+
if (node.getOpcode() < 0) {
339+
continue;
340+
}
341+
342+
if (node.getOpcode() <= 0x2d) {
338343
// *const*, ldc*, *push and *load* up to aload_3; all add a single value to the stack
339344
expectedArgs--;
340345
} else if (node.getOpcode() <= 0x35) {
@@ -391,7 +396,7 @@ private String getBundleKeyForMethodCall(@Nonnull final MethodInsnNode instructi
391396
// new creates a new object
392397
expectedArgs--;
393398
} else {
394-
// More branching instructions, throws and things we don't expect here
399+
// More branching instructions, throws and things we don't expect here, except checkcast / instanceof which take 1 and put 1
395400
}
396401
}
397402

0 commit comments

Comments
 (0)