當前位置: 首頁>>代碼示例>>Java>>正文


Java Type.VOID_TYPE屬性代碼示例

本文整理匯總了Java中org.objectweb.asm.Type.VOID_TYPE屬性的典型用法代碼示例。如果您正苦於以下問題:Java Type.VOID_TYPE屬性的具體用法?Java Type.VOID_TYPE怎麽用?Java Type.VOID_TYPE使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在org.objectweb.asm.Type的用法示例。


在下文中一共展示了Type.VOID_TYPE屬性的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: mapMethodDesc

public String mapMethodDesc(String desc) {
    if ("()V".equals(desc)) {
        return desc;
    }

    Type[] args = Type.getArgumentTypes(desc);
    StringBuilder sb = new StringBuilder("(");
    for (int i = 0; i < args.length; i++) {
        sb.append(mapDesc(args[i].getDescriptor()));
    }
    Type returnType = Type.getReturnType(desc);
    if (returnType == Type.VOID_TYPE) {
        sb.append(")V");
        return sb.toString();
    }
    sb.append(')').append(mapDesc(returnType.getDescriptor()));
    return sb.toString();
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:18,代碼來源:Remapper.java

示例2: visitInvokeDynamicInsn

@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm,
        Object... bsmArgs) {
    mv.visitInvokeDynamicInsn(name, desc, bsm, bsmArgs);
    if (constructor) {
        Type[] types = Type.getArgumentTypes(desc);
        for (int i = 0; i < types.length; i++) {
            popValue();
            if (types[i].getSize() == 2) {
                popValue();
            }
        }

        Type returnType = Type.getReturnType(desc);
        if (returnType != Type.VOID_TYPE) {
            pushValue(OTHER);
            if (returnType.getSize() == 2) {
                pushValue(OTHER);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:22,代碼來源:AdviceAdapter.java

示例3: box

/**
 * Generates the instructions to box the top stack value. This value is
 * replaced by its boxed equivalent on top of the stack.
 * 
 * @param type
 *            the type of the top stack value.
 */
public void box(final Type type) {
    if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
        return;
    }
    if (type == Type.VOID_TYPE) {
        push((String) null);
    } else {
        Type boxed = getBoxedType(type);
        newInstance(boxed);
        if (type.getSize() == 2) {
            // Pp -> Ppo -> oPpo -> ooPpo -> ooPp -> o
            dupX2();
            dupX2();
            pop();
        } else {
            // p -> po -> opo -> oop -> o
            dupX1();
            swap();
        }
        invokeConstructor(boxed, new Method("<init>", Type.VOID_TYPE,
                new Type[] { type }));
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:30,代碼來源:GeneratorAdapter.java

示例4: redirect

/**
 * Adds the instructions to do a generic redirection.
 */
protected void redirect(GeneratorAdapter mv, int change) {
    // code to check if a new implementation of the current class is available.
    Label l0 = new Label();
    mv.loadLocal(change);
    mv.visitJumpInsn(Opcodes.IFNULL, l0);
    doRedirect(mv, change);

    // Return
    if (type == Type.VOID_TYPE) {
        mv.pop();
    } else {
        ByteCodeUtils.unbox(mv, type);
    }
    mv.returnValue();

    // jump label for classes without any new implementation, just invoke the original
    // method implementation.
    mv.visitLabel(l0);
}
 
開發者ID:meili,項目名稱:Aceso,代碼行數:22,代碼來源:Redirection.java

示例5: doVisitMethodInsn

private void doVisitMethodInsn(int opcode, final String owner,
        final String name, final String desc, final boolean itf) {
    mv.visitMethodInsn(opcode, owner, name, desc, itf);
    if (constructor) {
        Type[] types = Type.getArgumentTypes(desc);
        for (int i = 0; i < types.length; i++) {
            popValue();
            if (types[i].getSize() == 2) {
                popValue();
            }
        }
        switch (opcode) {
        // case INVOKESTATIC:
        // break;
        case INVOKEINTERFACE:
        case INVOKEVIRTUAL:
            popValue(); // objectref
            break;
        case INVOKESPECIAL:
            Object type = popValue(); // objectref
            if (type == THIS && !superInitialized) {
                onMethodEnter();
                superInitialized = true;
                // once super has been initialized it is no longer
                // necessary to keep track of stack state
                constructor = false;
            }
            break;
        }

        Type returnType = Type.getReturnType(desc);
        if (returnType != Type.VOID_TYPE) {
            pushValue(OTHER);
            if (returnType.getSize() == 2) {
                pushValue(OTHER);
            }
        }
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:39,代碼來源:AdviceAdapter.java

示例6: valueOf

/**
 * Generates the instructions to box the top stack value using Java 5's
 * valueOf() method. This value is replaced by its boxed equivalent on top
 * of the stack.
 * 
 * @param type
 *            the type of the top stack value.
 */
public void valueOf(final Type type) {
    if (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY) {
        return;
    }
    if (type == Type.VOID_TYPE) {
        push((String) null);
    } else {
        Type boxed = getBoxedType(type);
        invokeStatic(boxed, new Method("valueOf", boxed,
                new Type[] { type }));
    }
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:20,代碼來源:GeneratorAdapter.java

示例7: newValue

@Override
public SourceValue newValue(final Type type) {
    if (type == Type.VOID_TYPE) {
        return null;
    }
    return new SourceValue(type == null ? 1 : type.getSize());
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:7,代碼來源:SourceInterpreter.java

示例8: updateStateForInvoke

private void updateStateForInvoke(String desc, boolean implicitReceiver) {
  // Pop arguments.
  Type[] parameterTypes = Type.getArgumentTypes(desc);
  state.popReverse(parameterTypes.length);
  // Pop implicit receiver if needed.
  if (implicitReceiver) {
    state.pop();
  }
  // Push return value if needed.
  Type returnType = Type.getReturnType(desc);
  if (returnType != Type.VOID_TYPE) {
    state.push(returnType);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:14,代碼來源:JarSourceCode.java

示例9: buildInvoke

private void buildInvoke(
    String methodDesc, Type methodOwner, boolean addImplicitReceiver,
    IRBuilder builder, BiConsumer<List<MoveType>, List<Integer>> creator) {

  // Build the argument list of the form [owner, param1, ..., paramN].
  // The arguments are in reverse order on the stack, so we pop off the parameters here.
  Type[] parameterTypes = Type.getArgumentTypes(methodDesc);
  Slot[] parameterRegisters = state.popReverse(parameterTypes.length);

  List<MoveType> types = new ArrayList<>(parameterTypes.length + 1);
  List<Integer> registers = new ArrayList<>(parameterTypes.length + 1);

  // Add receiver argument for non-static calls.
  if (addImplicitReceiver) {
    addArgument(types, registers, methodOwner, state.pop());
  }

  // The remaining arguments are the parameters of the method.
  for (int i = 0; i < parameterTypes.length; i++) {
    addArgument(types, registers, parameterTypes[i], parameterRegisters[i]);
  }

  // Create the invoke.
  creator.accept(types, registers);

  // Move the result to the "top of stack".
  Type returnType = Type.getReturnType(methodDesc);
  if (returnType != Type.VOID_TYPE) {
    builder.addMoveResult(moveType(returnType), state.push(returnType));
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:31,代碼來源:JarSourceCode.java

示例10: visitCode

@Override
        public void visitCode() {
            // local var
            super.visitLabel(start);
            change = newLocal(Type.getType(FIX_CLASS_NAME));
            System.out.println("change ===> " + change+":"+Type.getType(FIX_CLASS_NAME)+":"+Type.getObjectType(FIX_CLASS_NAME));
            mv.visitFieldInsn(Opcodes.GETSTATIC, visitedClassName, FIX_FIELD_NAME, FIX_CLASS_NAME);
            storeLocal(change);
            // localChangeFix != null
            loadLocal(change);
            // redirect
            Label l1 = new Label();
            visitJumpInsn(IFNULL, l1);
            // localChangeFix.isSupport("name+'.'+desc") == true
            loadLocal(change);
            push(name+"."+desc);
            mv.visitMethodInsn(INVOKEINTERFACE, "com/idtk/base/ChangeFix", "isSupport", "(Ljava/lang/String;)Z", true);
            mv.visitJumpInsn(IFEQ, l1);

            // object
            loadLocal(change);
            // param 1
            visitInsn(isStatic ? Opcodes.ICONST_1 : Opcodes.ICONST_0);
            // param 2
            push(name+"."+desc);
            // param 3
            createObjectArray();
            // invoke
            visitMethodInsn(INVOKEINTERFACE, "com/idtk/base/ChangeFix", "accessDispatch",
                    "(ZLjava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;", true);

            // return
            if (Type.getReturnType(desc) == Type.VOID_TYPE) {
                pop();
            } else {
                ByteCodeUtils.unbox(this, Type.getReturnType(desc));
            }
            returnValue();

            // end redirect
            visitLabel(l1);

            /*visitFieldInsn(Opcodes.GETSTATIC, visitedClassName, FIX_FIELD_NAME, FIX_CLASS_NAME);
            visitVarInsn(ASTORE, 2);
            Label l2 = new Label();
            // if
            visitVarInsn(ALOAD, 2);
            visitJumpInsn(IFNULL, l2);
            // 實例
            visitVarInsn(ALOAD, 2);
            // param 1
            visitVarInsn(ALOAD,0);
            // param 2
            visitLdcInsn(name+"."+desc);
            // param 3
            visitInsn(ICONST_1);
            visitTypeInsn(ANEWARRAY, "java/lang/Object");
//            visitVarInsn(ASTORE, 3);
//            visitVarInsn(ALOAD,3);
//            visitVarInsn(ALOAD,3);
            visitInsn(DUP);
            visitInsn(ICONST_0);
            visitVarInsn(ALOAD, 0);
            visitInsn(AASTORE);

            visitMethodInsn(INVOKEINTERFACE, "com/idtk/base/ChangeFix", "accessDispatch",
                    "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;", true);
            visitInsn(POP);
            visitInsn(RETURN);
            visitLabel(l2);*/

            super.visitCode();
        }
 
開發者ID:Idtk,項目名稱:Hotfix,代碼行數:73,代碼來源:ASMInsert.java

示例11: isGetter

private boolean isGetter(String name, String desc) {
	return name.startsWith("get") && desc.startsWith("()")
			&& Type.getReturnType(desc) != Type.VOID_TYPE
			|| name.startsWith("is") && desc.startsWith("()")
					&& Type.getReturnType(desc) == Type.BOOLEAN_TYPE;
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:6,代碼來源:CalledClassVisitor.java


注:本文中的org.objectweb.asm.Type.VOID_TYPE屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。