Closed wurensen closed 1 year ago
@wurensen, I cannot reproduce the problem. Please provide more context information about JDK version and flavour, AspectJ version and OS platform used. Ideally, extend the example to be a full MCVE including Maven build or exact compiler options. If I cannot reproduce it, I cannot fix it either.
@wurensen, because you did not react to my inquiry and failed to help me reproduce the problem, I am assuming that you either cannot reproduce it anymore or simply do not care about the problem enough to get it solved. Therefore, I am closing the issue. We can reopen it, if you make it reproducible for me.
@wurensen: OK, I just had an idea and did your job, preparing a reproducer for this problem. Actually, the problem does not occur if we just have a Java file with that kind of code. Additionally, we need an aspect processing that class. Only then will the BCEL TABLESWITCH
be used at all, not during normal Java compilation. We actually need to weave something. I.e., the reproducer is:
public class SwitchCaseWith_Integer_MAX_VALUE {
public static void main(String[] args) {
System.out.println(switchTest(Integer.MAX_VALUE));
}
static String switchTest(int i) {
switch (i) {
case Integer.MAX_VALUE:
return "CASE_1";
default:
return "";
}
}
}
aspect MyAspect {
before() : execution(* switchTest(*)) {
System.out.println(thisJoinPoint);
}
}
I can also confirm that your suggested fix works. Thanks for that.
the source code will cause ArrayIndexOutOfBoundsException if the
high
value oftableswitch
is Integer.MAX_VALUE:exception like this:
You can reproduce the bug if the weaved source code contain this:
I fixed it like this: