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


Java Type.OBJECT屬性代碼示例

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


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

示例1: mapType

private Type mapType(Type t) {
    switch (t.getSort()) {
    case Type.ARRAY:
        String s = mapDesc(t.getElementType().getDescriptor());
        for (int i = 0; i < t.getDimensions(); ++i) {
            s = '[' + s;
        }
        return Type.getType(s);
    case Type.OBJECT:
        s = map(t.getInternalName());
        return s != null ? Type.getObjectType(s) : t;
    case Type.METHOD:
        return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
    }
    return t;
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:16,代碼來源:Remapper.java

示例2: isSubTypeOf

@Override
protected boolean isSubTypeOf(final BasicValue value,
        final BasicValue expected) {
    Type expectedType = expected.getType();
    Type type = value.getType();
    switch (expectedType.getSort()) {
    case Type.INT:
    case Type.FLOAT:
    case Type.LONG:
    case Type.DOUBLE:
        return type.equals(expectedType);
    case Type.ARRAY:
    case Type.OBJECT:
        if ("Lnull;".equals(type.getDescriptor())) {
            return true;
        } else if (type.getSort() == Type.OBJECT
                || type.getSort() == Type.ARRAY) {
            return isAssignableFrom(expectedType, type);
        } else {
            return false;
        }
    default:
        throw new Error("Internal error");
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:25,代碼來源:SimpleVerifier.java

示例3: generateDefaultTraceAfter

private static void generateDefaultTraceAfter(InterceptedCall call, MethodVisitor mv, int mcvar, Type retType, MethodInfo minfo) {
    if (retType.getSort() == Type.VOID) {
        // Do nothing
    } else if (retType.getSort() == Type.ARRAY || retType.getSort() == Type.OBJECT) {
        mv.visitVarInsn(ALOAD, mcvar);
        mv.visitMethodInsn(INVOKESTATIC, RT_InternalName, "returnValue", "(Ljava/lang/Object;" + MethodCall_Desc + ")Ljava/lang/Object;", false);
        if (!"java/lang/Object".equals(retType.getInternalName()))
            mv.visitTypeInsn(CHECKCAST, retType.getInternalName());
    } else {
        mv.visitVarInsn(ALOAD, mcvar);
        String returnNativeType = minfo.returnNativeType;
        if ("GLenum".equals(returnNativeType) || "GLboolean".equals(returnNativeType)) {
            loadGLenumReturn(call.glName, "glEnumReturn", mv);
        } else if ("GLFWwindow *".equals(returnNativeType)) {
            mv.visitMethodInsn(INVOKESTATIC, RT_InternalName, "returnValueGlfwWindow", "(" + retType.getDescriptor() + MethodCall_Desc + ")" + retType.getDescriptor(), false);
        } else if ("GLFWmonitor *".equals(returnNativeType)) {
            mv.visitMethodInsn(INVOKESTATIC, RT_InternalName, "returnValueGlfwMonitor", "(" + retType.getDescriptor() + MethodCall_Desc + ")" + retType.getDescriptor(), false);
        } else {
            mv.visitMethodInsn(INVOKESTATIC, RT_InternalName, "returnValue", "(" + retType.getDescriptor() + MethodCall_Desc + ")" + retType.getDescriptor(), false);
        }
    }
    mv.visitVarInsn(ALOAD, mcvar);
    mv.visitMethodInsn(INVOKESTATIC, RT_InternalName, "methodCall", "(Lorg/lwjglx/debug/MethodCall;)V", false);
}
 
開發者ID:LWJGLX,項目名稱:debug,代碼行數:24,代碼來源:InterceptClassGenerator.java

示例4: memberType

private static MemberType memberType(Type type) {
  switch (type.getSort()) {
    case Type.ARRAY:
    case Type.OBJECT:
      return MemberType.OBJECT;
    case Type.BOOLEAN:
      return MemberType.BOOLEAN;
    case Type.BYTE:
      return MemberType.BYTE;
    case Type.SHORT:
      return MemberType.SHORT;
    case Type.CHAR:
      return MemberType.CHAR;
    case Type.INT:
    case Type.FLOAT:
      return MemberType.SINGLE;
    case Type.LONG:
    case Type.DOUBLE:
      return MemberType.WIDE;
    case Type.VOID:
      // Illegal. Throws in fallthrough.
    default:
      throw new Unreachable("Invalid type in memberType: " + type);
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:25,代碼來源:JarSourceCode.java

示例5: newValue

@Override
public BasicValue newValue(final Type t) {
  if (t != null) {
    final ValueHolderIden iden = HOLDERS.get(t.getDescriptor());
    if (iden != null) {
      final ReplacingBasicValue v = ReplacingBasicValue.create(t, iden, index++, valueList);
      v.markFunctionReturn();
      return v;
    }

    // We need to track use of the "this" objectref
    if ((t.getSort() == Type.OBJECT) && className.equals(t.getInternalName())) {
      final ReplacingBasicValue rbValue = ReplacingBasicValue.create(t, null, 0, valueList);
      rbValue.setThis();
      return rbValue;
    }
  }

  return super.newValue(t);
}
 
開發者ID:skhalifa,項目名稱:QDrill,代碼行數:20,代碼來源:ReplacingInterpreter.java

示例6: processReferenceAnnotation

private static Collection<Reference<? extends Item>> processReferenceAnnotation(Item item, AnnotationNode node, Class<?> annotClass) throws ConstraintException {
    if (!annotClass.isAnnotation())
        throw new IllegalArgumentException("annotClass must be an annotation type");
    if (!("L" + annotClass.getName().replace('.', '/') + ";").equals(node.desc))
        throw new IllegalArgumentException("annot class mismatch");
    Map<Object, Object> map = processPairs(node.values);
    Object value = map.get("value");
    if (!(value instanceof List))
        throw new ConstraintException("value not given");
    Object weakBoxed = map.get("weakBoxed");
    if (weakBoxed == null) {
        try {
            weakBoxed = annotClass.getDeclaredMethod("weak").getDefaultValue();
        } catch (NoSuchMethodException e) {
            throw new RuntimeException(e);
        }
    }
    if (!(weakBoxed instanceof Boolean))
        throw new ConstraintException("Invalid or null weak property type");
    boolean isStrong = !(boolean) weakBoxed;
    Collection<Reference<? extends Item>> refs = new ArrayList<>();
    for (Object ref : (List<?>) value) {
        String id = null;
        if (ref instanceof String)
            id = ((String) ref).replace(".", "/");
        else if (ref instanceof Type) {
            Type typ = (Type) ref;
            if (typ.getSort() == Type.OBJECT) {
                id = typ.getInternalName();
                if (id == null) throw new NullPointerException();
            }
        }
        if (id == null)
            throw new ConstraintException("Invalid type specified in value: " + ref + " (" + ref.getClass() + ")");
        refs.add(new ReferenceProxy<>(item, id, isStrong)); // TODO use legitimate one
    }
    return refs;
}
 
開發者ID:iamahuman,項目名稱:IdentObf,代碼行數:38,代碼來源:AsmAnnotationAdapter.java

示例7: merge

@Override
public BasicValue merge(final BasicValue v, final BasicValue w) {
    if (!v.equals(w)) {
        Type t = v.getType();
        Type u = w.getType();
        if (t != null
                && (t.getSort() == Type.OBJECT || t.getSort() == Type.ARRAY)) {
            if (u != null
                    && (u.getSort() == Type.OBJECT || u.getSort() == Type.ARRAY)) {
                if ("Lnull;".equals(t.getDescriptor())) {
                    return w;
                }
                if ("Lnull;".equals(u.getDescriptor())) {
                    return v;
                }
                if (isAssignableFrom(t, u)) {
                    return v;
                }
                if (isAssignableFrom(u, t)) {
                    return w;
                }
                // TODO case of array classes of the same dimension
                // TODO should we look also for a common super interface?
                // problem: there may be several possible common super
                // interfaces
                do {
                    if (t == null || isInterface(t)) {
                        return BasicValue.REFERENCE_VALUE;
                    }
                    t = getSuperClass(t);
                    if (isAssignableFrom(t, u)) {
                        return newValue(t);
                    }
                } while (true);
            }
        }
        return BasicValue.UNINITIALIZED_VALUE;
    }
    return v;
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Nonce-ID-Finder,代碼行數:40,代碼來源:SimpleVerifier.java

示例8: isAssignableFrom

protected boolean isAssignableFrom(final Type t, final Type u) {
    if (t.equals(u)) {
        return true;
    }
    if (currentClass != null && t.equals(currentClass)) {
        if (getSuperClass(u) == null) {
            return false;
        } else {
            if (isInterface) {
                return u.getSort() == Type.OBJECT
                        || u.getSort() == Type.ARRAY;
            }
            return isAssignableFrom(t, getSuperClass(u));
        }
    }
    if (currentClass != null && u.equals(currentClass)) {
        if (isAssignableFrom(t, currentSuperClass)) {
            return true;
        }
        if (currentClassInterfaces != null) {
            for (int i = 0; i < currentClassInterfaces.size(); ++i) {
                Type v = currentClassInterfaces.get(i);
                if (isAssignableFrom(t, v)) {
                    return true;
                }
            }
        }
        return false;
    }
    Class<?> tc = getClass(t);
    if (tc.isInterface()) {
        tc = Object.class;
    }
    return tc.isAssignableFrom(getClass(u));
}
 
開發者ID:ItzSomebody,項目名稱:Simple-JAR-Watermark,代碼行數:35,代碼來源:SimpleVerifier.java

示例9: isFieldInlineable

private boolean isFieldInlineable(int access, String desc) {
	if ((access & OPCODE_FIELD_INLINEABLE) != 0) {
		final Type type = Type.getType(desc);
		return type.getSort() != Type.OBJECT || "java.lang.String".equals(type.getClassName());
	}
	return false;
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:7,代碼來源:CalledClassVisitor.java

示例10: checkLDCConstant

void checkLDCConstant(final Object cst) {
    if (cst instanceof Type) {
        int s = ((Type) cst).getSort();
        if (s != Type.OBJECT && s != Type.ARRAY && s != Type.METHOD) {
            throw new IllegalArgumentException("Illegal LDC constant value");
        }
        if (s != Type.METHOD && (version & 0xFFFF) < Opcodes.V1_5) {
            throw new IllegalArgumentException(
                    "ldc of a constant class requires at least version 1.5");
        }
        if (s == Type.METHOD && (version & 0xFFFF) < Opcodes.V1_7) {
            throw new IllegalArgumentException(
                    "ldc of a method type requires at least version 1.7");
        }
    } else if (cst instanceof Handle) {
        if ((version & 0xFFFF) < Opcodes.V1_7) {
            throw new IllegalArgumentException(
                    "ldc of a handle requires at least version 1.7");
        }
        int tag = ((Handle) cst).getTag();
        if (tag < Opcodes.H_GETFIELD || tag > Opcodes.H_INVOKEINTERFACE) {
            throw new IllegalArgumentException("invalid handle tag " + tag);
        }
    } else {
        checkConstant(cst);
    }
}
 
開發者ID:acmerli,項目名稱:fastAOP,代碼行數:27,代碼來源:CheckMethodAdapter.java

示例11: newValue

@Override
public BasicValue newValue(final Type type) {
    if (type == null) {
        return BasicValue.UNINITIALIZED_VALUE;
    }
    switch (type.getSort()) {
    case Type.VOID:
        return null;
    case Type.BOOLEAN:
    case Type.CHAR:
    case Type.BYTE:
    case Type.SHORT:
    case Type.INT:
        return BasicValue.INT_VALUE;
    case Type.FLOAT:
        return BasicValue.FLOAT_VALUE;
    case Type.LONG:
        return BasicValue.LONG_VALUE;
    case Type.DOUBLE:
        return BasicValue.DOUBLE_VALUE;
    case Type.ARRAY:
    case Type.OBJECT:
        return BasicValue.REFERENCE_VALUE;
    default:
        throw new Error("Internal error");
    }
}
 
開發者ID:ItzSomebody,項目名稱:BukkitPlugin-Message-Injector,代碼行數:27,代碼來源:BasicInterpreter.java

示例12: visitInvokeDynamicInsn

@Override
public void visitInvokeDynamicInsn(String name, String desc, Handle bsm, Object... bsmArgs) {
  registerMethodHandleType(bsm);

  // Register bootstrap method arguments, only Type and MethodHandle need to be register.
  for (Object arg : bsmArgs) {
    if (arg instanceof Type && ((Type) arg).getSort() == Type.OBJECT) {
      registry.registerTypeReference(application.getType((Type) arg));
    } else if (arg instanceof Handle) {
      registerMethodHandleType((Handle) arg);
    }
  }
}
 
開發者ID:inferjay,項目名稱:r8,代碼行數:13,代碼來源:JarRegisterEffectsVisitor.java

示例13: ifCmp

/**
 * Generates the instructions to jump to a label based on the comparison of
 * the top two stack values.
 * 
 * @param type
 *            the type of the top two stack values.
 * @param mode
 *            how these values must be compared. One of EQ, NE, LT, GE, GT,
 *            LE.
 * @param label
 *            where to jump if the comparison result is <tt>true</tt>.
 */
public void ifCmp(final Type type, final int mode, final Label label) {
    switch (type.getSort()) {
    case Type.LONG:
        mv.visitInsn(Opcodes.LCMP);
        break;
    case Type.DOUBLE:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.DCMPL
                : Opcodes.DCMPG);
        break;
    case Type.FLOAT:
        mv.visitInsn(mode == GE || mode == GT ? Opcodes.FCMPL
                : Opcodes.FCMPG);
        break;
    case Type.ARRAY:
    case Type.OBJECT:
        switch (mode) {
        case EQ:
            mv.visitJumpInsn(Opcodes.IF_ACMPEQ, label);
            return;
        case NE:
            mv.visitJumpInsn(Opcodes.IF_ACMPNE, label);
            return;
        }
        throw new IllegalArgumentException("Bad comparison for type "
                + type);
    default:
        int intOp = -1;
        switch (mode) {
        case EQ:
            intOp = Opcodes.IF_ICMPEQ;
            break;
        case NE:
            intOp = Opcodes.IF_ICMPNE;
            break;
        case GE:
            intOp = Opcodes.IF_ICMPGE;
            break;
        case LT:
            intOp = Opcodes.IF_ICMPLT;
            break;
        case LE:
            intOp = Opcodes.IF_ICMPLE;
            break;
        case GT:
            intOp = Opcodes.IF_ICMPGT;
            break;
        }
        mv.visitJumpInsn(intOp, label);
        return;
    }
    mv.visitJumpInsn(mode, label);
}
 
開發者ID:ItzSomebody,項目名稱:Spigot-Attribute-Remover,代碼行數:64,代碼來源:GeneratorAdapter.java

示例14: isReference

public boolean isReference() {
    return type != null
            && (type.getSort() == Type.OBJECT || type.getSort() == Type.ARRAY);
}
 
開發者ID:ItzSomebody,項目名稱:DirectLeaks-AntiReleak-Remover,代碼行數:4,代碼來源:BasicValue.java

示例15: fromTypes

private String[] fromTypes(Type[] types) throws ClassNotFoundException {
  if (types == null) throw new IllegalArgumentException("Types was null!");
  String[] clz = new String[types.length];
  for (int i = 0; i < clz.length; i++) {
    Type t = types[i];
    switch (t.getSort()) {
      case Type.OBJECT:
        clz[i] = t.getClassName();
        break;
      case Type.LONG:
        clz[i] = Long.TYPE.getName();
        break;
      case Type.FLOAT:
        clz[i] = Float.TYPE.getName();
        break;
      case Type.DOUBLE:
        clz[i] = Double.TYPE.getName();
        break;
      case Type.BYTE:
        clz[i] = Byte.TYPE.getName();
        break;
      case Type.INT:
        clz[i] = Integer.TYPE.getName();
        break;
      case Type.BOOLEAN:
        clz[i] = Boolean.TYPE.getName();
        break;
      case Type.SHORT:
        clz[i] = Short.TYPE.getName();
        break;
      case Type.CHAR:
        clz[i] = Character.TYPE.getName();
        break;
      case Type.ARRAY:
        clz[i] = t.getDescriptor().replace("/", ".");
        break;
      default:
        throw new IllegalArgumentException("Invalid argument type: " + t.getSort());
    }
  }
  return clz;
}
 
開發者ID:mnemonic-no,項目名稱:common-services,代碼行數:42,代碼來源:ServiceMessageClient.java


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