public void fieldsAccept(MemberVisitor memberVisitor) { for (int index = 0; index < fields.length; index++) { Field field = fields[index]; if (field != null) { field.accept(this, memberVisitor); } } }
public Field findField(String name, String descriptor) { for (int index = 0; index < fields.length; index++) { Field field = fields[index]; if (field != null && (name == null || field.getName(this).equals(name)) && (descriptor == null || field.getDescriptor(this).equals(descriptor))) { return field; } } return null; }
public FieldOptimizationInfo(Clazz clazz, Field field) { int accessFlags = field.getAccessFlags(); isWritten = isRead = (accessFlags & ClassConstants.INTERNAL_ACC_VOLATILE) != 0; if ((accessFlags & ClassConstants.INTERNAL_ACC_STATIC) != 0) { // See if we can initialize the static field with a constant value. field.accept(clazz, new AllAttributeVisitor(this)); } if ((accessFlags & ClassConstants.INTERNAL_ACC_FINAL) == 0 && value == null) { // Otherwise initialize the non-final field with the default value. value = initialValue(field.getDescriptor(clazz)); } }
public static FieldOptimizationInfo getFieldOptimizationInfo(Field field) { Object visitorInfo = field.getVisitorInfo(); return visitorInfo instanceof FieldOptimizationInfo ? (FieldOptimizationInfo) visitorInfo : null; }
public void fieldAccept(String name, String descriptor, MemberVisitor memberVisitor) { Field field = findField(name, descriptor); if (field != null) { field.accept(this, memberVisitor); } }
public static void setFieldOptimizationInfo(Clazz clazz, Field field) { field.setVisitorInfo(new FieldOptimizationInfo(clazz, field)); }