Package org.apache.xbean.asm

Examples of org.apache.xbean.asm.MethodVisitor.visitLabel()


    }
   
//    mv.visitTryCatchBlock(l0, l1, l3, "java/lang/Throwable");
   
    // push try code
    mv.visitLabel(l0);
    String clsToOverride = method.getDeclaringClass().getName().replaceAll("\\.", "/");
    mv.visitLdcInsn(Type.getType("L" + clsToOverride + ";"));
   
    // the following code generates the bytecode for this line of Java:
    // Method method = <proxy>.class.getMethod("add", new Class[] { <array of function argument classes> });
View Full Code Here


   
    // the following code generates bytecode equivalent to:
    // return ((<returntype>) invocationHandler.invoke(this, method, new Object[] { <function arguments }))[.<primitive>Value()];
   
    Label l4 = new Label();
    mv.visitLabel(l4);
    mv.visitVarInsn(ALOAD, 0);
   
    // get the invocationHandler field from this class
    mv.visitFieldInsn(GETFIELD, proxyName, handlerName, "Ljava/lang/reflect/InvocationHandler;");
   
View Full Code Here

      // get the primitive value   
      mv.visitMethodInsn(INVOKEVIRTUAL, getWrapperType(returnType), getPrimitiveMethod(returnType), "()" + getPrimitiveLetter(returnType));
    }
   
    // push return
    mv.visitLabel(l1);
    if (! Void.TYPE.equals(returnType)) {
      mv.visitInsn(getReturnInsn(returnType));
    } else {
      mv.visitInsn(POP);
      mv.visitInsn(RETURN);
View Full Code Here

      mv.visitInsn(RETURN);
    }

    // catch InvocationTargetException
    if (exceptionTypes.length > 0) {
      mv.visitLabel(l2);
      mv.visitVarInsn(ASTORE, length);
      Label l5 = new Label();
      mv.visitLabel(l5);
 
      for (int i = 0; i < exceptionTypes.length; i++) {
View Full Code Here

    // catch InvocationTargetException
    if (exceptionTypes.length > 0) {
      mv.visitLabel(l2);
      mv.visitVarInsn(ASTORE, length);
      Label l5 = new Label();
      mv.visitLabel(l5);
 
      for (int i = 0; i < exceptionTypes.length; i++) {
        Class<?> exceptionType = exceptionTypes[i];
       
        mv.visitLdcInsn(Type.getType("L" + exceptionType.getCanonicalName().replaceAll("\\.", "/") + ";"));
View Full Code Here

        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;");
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/Object", "equals", "(Ljava/lang/Object;)Z");
        Label l6 = new Label();
        mv.visitJumpInsn(IFEQ, l6);
        Label l7 = new Label();
        mv.visitLabel(l7);
        mv.visitVarInsn(ALOAD, length);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause", "()Ljava/lang/Throwable;");
        mv.visitTypeInsn(CHECKCAST, exceptionType.getCanonicalName().replaceAll("\\.", "/"));
        mv.visitInsn(ATHROW);
        mv.visitLabel(l6);
View Full Code Here

        mv.visitLabel(l7);
        mv.visitVarInsn(ALOAD, length);
        mv.visitMethodInsn(INVOKEVIRTUAL, "java/lang/reflect/InvocationTargetException", "getCause", "()Ljava/lang/Throwable;");
        mv.visitTypeInsn(CHECKCAST, exceptionType.getCanonicalName().replaceAll("\\.", "/"));
        mv.visitInsn(ATHROW);
        mv.visitLabel(l6);
       
        if (i == (exceptionTypes.length - 1)) {
          mv.visitTypeInsn(NEW, "java/lang/reflect/UndeclaredThrowableException");
          mv.visitInsn(DUP);
          mv.visitVarInsn(ALOAD, length);
View Full Code Here

        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
        Label notDeleted = new Label();
        mv.visitJumpInsn(IFEQ, notDeleted);
        mv.visitInsn(RETURN);
        mv.visitLabel(notDeleted);

        // deleted = true;
        mv.visitVarInsn(ALOAD, 0);
        mv.visitInsn(ICONST_1);
        mv.visitFieldInsn(PUTFIELD, implClassName, DELETED, "Z");
View Full Code Here

        mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
        Label notDeleted = new Label();
        mv.visitJumpInsn(IFEQ, notDeleted);
        mv.visitInsn(ACONST_NULL);
        mv.visitInsn(ARETURN);
        mv.visitLabel(notDeleted);

        for (CmrField cmrField : cmrFields) {
            // if ("${cmrField.name}".equals(name)) {
            //     ${cmrField.name}.add((${cmrField.type})value);
            //     return null;
View Full Code Here

        mv.visitVarInsn(ALOAD, 0);
        mv.visitFieldInsn(GETFIELD, implClassName, DELETED, "Z");
        Label notDeleted = new Label();
        mv.visitJumpInsn(IFEQ, notDeleted);
        mv.visitInsn(RETURN);
        mv.visitLabel(notDeleted);

        for (CmrField cmrField : cmrFields) {
            // if ("${cmrField.name}".equals(name)) {
            //     ${cmrField.name}.remove(value);
            //     return;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.