You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Freeman Fang (JIRA)" <ji...@apache.org> on 2018/05/04 01:56:00 UTC

[jira] [Created] (ARIES-1797) ensure proxy-impl can work with ASM 6.1 plus

Freeman Fang created ARIES-1797:
-----------------------------------

             Summary: ensure proxy-impl can work with ASM 6.1 plus
                 Key: ARIES-1797
                 URL: https://issues.apache.org/jira/browse/ARIES-1797
             Project: Aries
          Issue Type: Improvement
            Reporter: Freeman Fang


In asm 6.1, the GeneratorAdapter.case method changed to

{code}

public void cast(final Type from, final Type to) {
    if (from != to) {
      if (from == Type.DOUBLE_TYPE) {
        if (to == Type.FLOAT_TYPE) {
          mv.visitInsn(Opcodes.D2F);
        } else if (to == Type.LONG_TYPE) {
          mv.visitInsn(Opcodes.D2L);
        } else {
          mv.visitInsn(Opcodes.D2I);
          cast(Type.INT_TYPE, to);
        }
      } else if (from == Type.FLOAT_TYPE) {
        if (to == Type.DOUBLE_TYPE) {
          mv.visitInsn(Opcodes.F2D);
        } else if (to == Type.LONG_TYPE) {
          mv.visitInsn(Opcodes.F2L);
        } else {
          mv.visitInsn(Opcodes.F2I);
          cast(Type.INT_TYPE, to);
        }
      } else if (from == Type.LONG_TYPE) {
        if (to == Type.DOUBLE_TYPE) {
          mv.visitInsn(Opcodes.L2D);
        } else if (to == Type.FLOAT_TYPE) {
          mv.visitInsn(Opcodes.L2F);
        } else {
          mv.visitInsn(Opcodes.L2I);
          cast(Type.INT_TYPE, to);
        }
      } else {
        if (to == Type.BYTE_TYPE) {
          mv.visitInsn(Opcodes.I2B);
        } else if (to == Type.CHAR_TYPE) {
          mv.visitInsn(Opcodes.I2C);
        } else if (to == Type.DOUBLE_TYPE) {
          mv.visitInsn(Opcodes.I2D);
        } else if (to == Type.FLOAT_TYPE) {
          mv.visitInsn(Opcodes.I2F);
        } else if (to == Type.LONG_TYPE) {
          mv.visitInsn(Opcodes.I2L);
        } else if (to == Type.SHORT_TYPE) {
          mv.visitInsn(Opcodes.I2S);
        } else {
          throw new IllegalArgumentException(); 
        }          
      }
    }
  }

{code}

 

Compared with previous version, it added a

{code}

} else {
          throw new IllegalArgumentException(); 
        }          

{code}

at the end, however, this break the current logic in proxy-impl, with if "cast" not take effect, can still go with "unbox", we should revise proxy-impl a bit to honor the change in ASM 6.1. Ensure proxy-impl can work with ASM 6.1 on the classpath or in the OSGi container



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)