Details
-
Bug
-
Status: Closed
-
Resolution: Invalid
-
5.1
-
None
-
None
-
Operating System: Windows 2000
Platform: Other
-
blocker
-
P1
-
35405
Description
We are using bcel library for code generation. And for some particualr scenarios
our method size is exceeding the method size limit defined by java (65535 bytes)
and we get the following error,
org.apache.bcel.generic.ClassGenException: Branch target offset too large for short
at org.apache.bcel.generic.BranchInstruction.dump(BranchInstruction.java:100)
at org.apache.bcel.generic.InstructionList.getByteCode(InstructionList.java:980)
at org.apache.bcel.generic.MethodGen.getMethod(MethodGen.java:616)
When the method size limit is defined in java as 65535, why does the BCEL gives
an error for 32767, in
org.apache.bcel.generic.BranchInstruction.dump(DataOutputStream out) the check
is for,
if(Math.abs(index) >= 32767) // too large for short
throw new ClassGenException("Branch target offset too large for short");
why not instead have the if(Math.abs(index) >= 65535)
I tried this and then my application works fine, I want to be sure if thats the
right approach.