/** @return true if this is a direct method */
 public boolean isDirect() {
   return ((accessFlags
           & (AccessFlags.STATIC.getValue()
               | AccessFlags.PRIVATE.getValue()
               | AccessFlags.CONSTRUCTOR.getValue()))
       != 0);
 }
Exemple #2
0
  private void updateInvokeType(Instruction inst, MethodIdItem newMethod) {
    int accessFlags = newMethod.getAccess();
    int staticMask = AccessFlags.STATIC.getValue();
    int privateMask = AccessFlags.PRIVATE.getValue();
    int finalMask = AccessFlags.FINAL.getValue();
    int constructorMask = AccessFlags.CONSTRUCTOR.getValue();
    int directMask = privateMask | finalMask | constructorMask;

    if ((accessFlags & staticMask) != 0) {
      if (inst instanceof Instruction35c) {
        inst.opcode = Opcode.INVOKE_STATIC;
      } else if (inst instanceof Instruction3rc) {
        inst.opcode = Opcode.INVOKE_STATIC_RANGE;
      }

    } else if ((accessFlags & directMask) != 0) {
      if (inst instanceof Instruction35c) {
        inst.opcode = Opcode.INVOKE_DIRECT;
      } else if (inst instanceof Instruction3rc) {
        inst.opcode = Opcode.INVOKE_DIRECT_RANGE;
      }

    } else {
      if (inst instanceof Instruction35c) {
        inst.opcode = Opcode.INVOKE_VIRTUAL;
      } else if (inst instanceof Instruction3rc) {
        inst.opcode = Opcode.INVOKE_VIRTUAL_RANGE;
      }
    }
  }
 /** @return true if this is a static field */
 public boolean isStatic() {
   return (accessFlags & AccessFlags.STATIC.getValue()) != 0;
 }