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

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

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

JIRA jira@apache.org

     [ https://issues.apache.org/jira/browse/ARIES-1797?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Freeman Fang updated ARIES-1797:
--------------------------------
    Description:
In asm 6.1, the GeneratorAdapter.case method changed to
{code:java}
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:java}
} else {
          throw new IllegalArgumentException();
        }          

{code}
at the end, however, this break the current logic in proxy-impl, which 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

  was:
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


> 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
>            Priority: Major
>         Attachments: ARIES-1797.patch
>
>
> In asm 6.1, the GeneratorAdapter.case method changed to
> {code:java}
> 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:java}
> } else {
>           throw new IllegalArgumentException();
>         }          
> {code}
> at the end, however, this break the current logic in proxy-impl, which 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)