It may seem complicated. My knowledge is incomplete, but you have at least three kinds of instructions to look for (NEWARRAY, ANEWARRAY and MULTIANEWARRAY). Looking at the previous instruction (or in the case of MULTIANEWARRAY, n of the previous instructions) it gets a size that, even if it was a constant, can be loaded using BIPUSH, SIPUSH or LDC (anything else?) Depending on the size. As you noticed, if a class is the result of a calculation, you can track instructions back indefinitely.
If I remember correctly, FindBugs uses BCEL internally, but I never dug there to understand how smart they are. If each of these groups has corresponding mailing lists, they might be better off to ask - they will probably at least find out if anyone has been along the way before.
source share