FieldId(TypeId<D> declaringType, TypeId<V> type, String name) { if (declaringType == null || type == null || name == null) { throw new NullPointerException(); } this.declaringType = declaringType; this.type = type; this.name = name; this.nat = new CstNat(new CstString(name), new CstString(type.name)); this.constant = new CstFieldRef(declaringType.constant, nat); }
private void addDependencies(ConstantPool pool) { for (Constant constant : pool.getEntries()) { if (constant instanceof CstType) { checkDescriptor(((CstType) constant).getClassType()); } else if (constant instanceof CstFieldRef) { checkDescriptor(((CstFieldRef) constant).getType()); } else if (constant instanceof CstMethodRef) { Prototype proto = ((CstMethodRef) constant).getPrototype(); checkDescriptor(proto.getReturnType()); StdTypeList args = proto.getParameterTypes(); for (int i = 0; i < args.size(); i++) { checkDescriptor(args.get(i)); } } } }
/** * {@inheritDoc} * * <p><b>Note:</b> This compares the method constants only, * ignoring any associated code, because it should never be the * case that two different items with the same method constant * ever appear in the same list (or same file, even).</p> */ @Override public int compareTo(EncodedField other) { return field.compareTo(other.field); }
/** {@inheritDoc} */ @Override public String toHuman() { return field.toHuman(); }
/** {@inheritDoc} */ @Override public CstString getName() { return field.getNat().getName(); }
/** {@inheritDoc} */ @Override public int hashCode() { return field.hashCode(); }
/** {@inheritDoc} */ @Override public boolean equals(Object other) { if (! (other instanceof FieldAnnotationStruct)) { return false; } return field.equals(((FieldAnnotationStruct) other).field); }
CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.IGET_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.IPUT_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.SGET_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.SPUT_BOOLEAN;
CstFieldRef.forPrimitiveType(componentType); insn = new ThrowingCstInsn(Rops.GET_STATIC_OBJECT, pos, RegisterSpecList.EMPTY,
/** {@inheritDoc} */ @Override public String toHuman() { return field.toHuman() + ": " + annotations; }
/** * Returns the type of this field. * * @return {@code non-null;} the field's type */ @Override public Type getType() { return getNat().getFieldType(); }
/** {@inheritDoc} */ @Override public int hashCode() { return field.hashCode(); }
/** {@inheritDoc} */ public boolean equals(Object other) { if (! (other instanceof FieldAnnotationStruct)) { return false; } return field.equals(((FieldAnnotationStruct) other).field); }
CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.IGET_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.IPUT_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.SGET_BOOLEAN; CstFieldRef ref = (CstFieldRef) ((ThrowingCstInsn) insn).getConstant(); int basicType = ref.getBasicType(); switch (basicType) { case Type.BT_BOOLEAN: return Dops.SPUT_BOOLEAN;
CstFieldRef.forPrimitiveType(componentType); insn = new ThrowingCstInsn(Rops.GET_STATIC_OBJECT, pos, RegisterSpecList.EMPTY,
/** * Returns an instance of this class that represents the static * field which should hold the class corresponding to a given * primitive type. For example, if given {@link Type#INT}, this * method returns an instance corresponding to the field * {@code java.lang.Integer.TYPE}. * * @param primitiveType {@code non-null;} the primitive type * @return {@code non-null;} the corresponding static field */ public static CstFieldRef forPrimitiveType(Type primitiveType) { return new CstFieldRef(CstType.forBoxedPrimitiveType(primitiveType), CstNat.PRIMITIVE_TYPE_NAT); }
private void addDependencies(DirectClassFile classFile) { for (Constant constant : classFile.getConstantPool().getEntries()) { if (constant instanceof CstType) { checkDescriptor(((CstType) constant).getClassType().getDescriptor()); } else if (constant instanceof CstFieldRef) { checkDescriptor(((CstFieldRef) constant).getType().getDescriptor()); } else if (constant instanceof CstBaseMethodRef) { checkPrototype(((CstBaseMethodRef) constant).getPrototype()); } } FieldList fields = classFile.getFields(); int nbField = fields.size(); for (int i = 0; i < nbField; i++) { checkDescriptor(fields.get(i).getDescriptor().getString()); } MethodList methods = classFile.getMethods(); int nbMethods = methods.size(); for (int i = 0; i < nbMethods; i++) { checkPrototype(Prototype.intern(methods.get(i).getDescriptor().getString())); } } private void checkPrototype(Prototype proto) {
/** {@inheritDoc} */ @Override public int compareTo(FieldAnnotationStruct other) { return field.compareTo(other.field); }
/** {@inheritDoc} */ @Override public String toHuman() { return field.toHuman(); }
/** * Returns the type of this field. * * @return {@code non-null;} the field's type */ public Type getType() { return getNat().getFieldType(); }