Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Handle Unable to pack method, jump in aspectj

Hi,

When i use the aspectj in our application, i am facing the following exception.
Caused by: java.lang.IllegalStateException: Unable to pack method, jump (with opcode=158) is too far: 32089
        at org.aspectj.apache.bcel.generic.InstructionBranch.updatePosition(InstructionBranch.java:176)
        at org.aspectj.apache.bcel.generic.BranchHandle.updatePosition(BranchHandle.java:101)
        at org.aspectj.apache.bcel.generic.InstructionList.setPositions(InstructionList.java:919)
        at org.aspectj.apache.bcel.generic.InstructionList.setPositions(InstructionList.java:863)
        at org.aspectj.apache.bcel.generic.InstructionList.getByteCode(InstructionList.java:981)
        at org.aspectj.apache.bcel.generic.MethodGen.getMethod(MethodGen.java:697)
        ... 68 more

When i check the aspectj source code, it looks as follows.
 protected int updatePosition(int offset, int max_offset)
  {
    int i = getTargetOffset();

    this.positionOfThisInstruction += offset;

    if ((Math.abs(i) >= 32767 - max_offset) && (this.opcode != 201) && (this.opcode != 200))
    {
      if ((this.opcode == 168) || (this.opcode == 167)) {
        if (this.opcode == 168)
          this.opcode = 201;
        else {
          this.opcode = 200;
        }
        return 2;
      }
      throw new IllegalStateException("Unable to pack method, jump (with opcode=" + this.opcode + ") is too far: " +
        Math.abs(i));
    }

    return 0;
  }


Hi Andy,
What exactly is happening here, can you share more details on how to avoid this.
Thanks,
Krishna

=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you


Back to the top