Java 类org.apache.bcel.generic.BasicType 实例源码

项目:root4j    文件:StreamerInfoString.java   
public void generateReadCode(InstructionList il, InstructionFactory factory, ConstantPoolGen cp, String className)
{
   if (pointer)
   {
      ((GenericRootClass) varClass).generateReadPointerCode(il, factory, cp);
   }
   else if (dim == 0)
   {
      varClass.generateReadCode(il, factory, cp);
   }
   else if (varCounter == null)
   {
      ((IntrinsicRootClass) varClass).generateReadArrayCode(il, factory, cp, 1, new int[]{index});
   }
   else 
   {
      BasicMember varMember = getMember(varCounter);
      if (varMember == null) throw new RuntimeException("Cannot find variable counter "+varCounter);
      Type varMemberType = varMember.getJavaType();
      il.append(InstructionConstants.ALOAD_0);
      il.append(factory.createInvoke(className, nameMangler.mangleMember(varCounter), varMemberType, Type.NO_ARGS, INVOKESPECIAL));
      if (varMemberType != Type.INT  &&  varMemberType != Type.BYTE  &&  varMemberType != Type.CHAR  &&  varMemberType != Type.SHORT)
          il.append(factory.createCast(varMemberType, Type.INT));

      BasicType type = (BasicType) varClass.getJavaType();
      il.append(new NEWARRAY(type));
      il.append(InstructionConstants.DUP_X1);

      Type[] arrayArgType = new Type[] { new ArrayType(type, 1) };
      il.append(factory.createInvoke("org.dianahep.root4j.core.RootInput", "readFixedArray", Type.VOID, arrayArgType, INVOKEINTERFACE));
   }
   if (varClass.getConvertMethod() != null)
   {
      il.append(factory.createInvoke("org.dianahep.root4j.interfaces." + varClass.getClassName(), varClass.getConvertMethod(), varClass.getJavaTypeForMethod(), Type.NO_ARGS, INVOKEINTERFACE));
   }
}
项目:root4j    文件:IntrinsicRootClass.java   
IntrinsicRootClass(String name, BasicType type, Class javaClass, String readMethod)
{
   this.name = name;
   this.type = type;
   this.javaClass = javaClass;
   this.readMethod = readMethod;
   this.arrayArgType = new Type[] { new ArrayType(type, 1) };
}
项目:DecompileTools    文件:FieldFinderHelpers.java   
public static boolean shouldIgnoreField(JavaClass clazz, Field field) {
    if (clazz.isEnum() && field.isStatic()) {
        return true;
    }
    if (field.isSynthetic() || field.getType() instanceof BasicType) {
        return true;
    }
    return false;
}
项目:cn1    文件:Clazz.java   
/**
 * Searches the given class for the static final fields type of which
 * is a primitive data type.
 * 
 * @param clss - a searched class.
 */
private void searchForFields(JavaClass clss) {
    Field field[] = clss.getFields();
    for (int i = 0; i < field.length; i++) {
        Field f = field[i];
        if (f.isStatic() && f.isFinal()) {
            if (Type.getReturnType(f.getSignature()) instanceof BasicType) {
                fields.addElement(new ClazzField(this, f));
            }
        }
    }
}
项目:freeVM    文件:Clazz.java   
/**
 * Searches the given class for the static final fields type of which
 * is a primitive data type.
 * 
 * @param clss - a searched class.
 */
private void searchForFields(JavaClass clss) {
    Field field[] = clss.getFields();
    for (int i = 0; i < field.length; i++) {
        Field f = field[i];
        if (f.isStatic() && f.isFinal()) {
            if (Type.getReturnType(f.getSignature()) instanceof BasicType) {
                fields.addElement(new ClazzField(this, f));
            }
        }
    }
}
项目:cashmere    文件:Cashmerec.java   
static String getInitVal(Type s) {
    if (s instanceof BasicType) {
        return "0";
    }
    return "null";
}
项目:findbugs-all-the-bugs    文件:IncompatibleTypes.java   
static public @Nonnull
IncompatibleTypes getPriorityForAssumingCompatible(Type expectedType, Type actualType, boolean pointerEquality) {
    if (!(expectedType instanceof ReferenceType))
        return SEEMS_OK;
    if (!(actualType instanceof ReferenceType))
        return SEEMS_OK;

    if (expectedType instanceof BasicType ^ actualType instanceof BasicType) {
        return INCOMPATIBLE_CLASSES;
    }
    while (expectedType instanceof ArrayType && actualType instanceof ArrayType) {
        expectedType = ((ArrayType) expectedType).getElementType();
        actualType = ((ArrayType) actualType).getElementType();
    }

    if (expectedType instanceof BasicType ^ actualType instanceof BasicType) {
        return PRIMATIVE_ARRAY_AND_OTHER_ARRAY;
    }
    if (expectedType instanceof BasicType && actualType instanceof BasicType) {
        if (!expectedType.equals(actualType))
            return INCOMPATIBLE_PRIMATIVE_ARRAYS;
        else
            return SEEMS_OK;
    }
    if (expectedType instanceof ArrayType) {
        return getPriorityForAssumingCompatibleWithArray(actualType);
    }
    if (actualType instanceof ArrayType) {
        return getPriorityForAssumingCompatibleWithArray(expectedType);
    }
    if (expectedType.equals(actualType))
        return SEEMS_OK;

    // For now, ignore the case where either reference is not
    // of an object type. (It could be either an array or null.)
    if (!(expectedType instanceof ObjectType) || !(actualType instanceof ObjectType))
        return SEEMS_OK;

    return getPriorityForAssumingCompatible((ObjectType) expectedType, (ObjectType) actualType, pointerEquality);

}
项目:FindBug-for-Domino-Designer    文件:IncompatibleTypes.java   
static public @Nonnull
IncompatibleTypes getPriorityForAssumingCompatible(Type expectedType, Type actualType, boolean pointerEquality) {
    if (expectedType.equals(actualType))
        return SEEMS_OK;

    if (!(expectedType instanceof ReferenceType))
        return SEEMS_OK;
    if (!(actualType instanceof ReferenceType))
        return SEEMS_OK;

    if (expectedType instanceof BasicType ^ actualType instanceof BasicType) {
        return INCOMPATIBLE_CLASSES;
    }
    while (expectedType instanceof ArrayType && actualType instanceof ArrayType) {
        expectedType = ((ArrayType) expectedType).getElementType();
        actualType = ((ArrayType) actualType).getElementType();
    }

    if (expectedType instanceof BasicType ^ actualType instanceof BasicType) {
        return PRIMATIVE_ARRAY_AND_OTHER_ARRAY;
    }
    if (expectedType instanceof BasicType && actualType instanceof BasicType) {
        if (!expectedType.equals(actualType))
            return INCOMPATIBLE_PRIMATIVE_ARRAYS;
        else
            return SEEMS_OK;
    }
    if (expectedType instanceof ArrayType) {
        return getPriorityForAssumingCompatibleWithArray(actualType);
    }
    if (actualType instanceof ArrayType) {
        return getPriorityForAssumingCompatibleWithArray(expectedType);
    }
    if (expectedType.equals(actualType))
        return SEEMS_OK;

    // For now, ignore the case where either reference is not
    // of an object type. (It could be either an array or null.)
    if (!(expectedType instanceof ObjectType) || !(actualType instanceof ObjectType))
        return SEEMS_OK;

    return getPriorityForAssumingCompatible((ObjectType) expectedType, (ObjectType) actualType, pointerEquality);

}