/** * This method returns is a given field is final or not. * Since we might have removed the <code>final</code> modifier * during our instrumentation, we also check the list of those * static fields we have modified during the instrumentation. * * @param field field to check * @return */ public static boolean isFinalField(Field field) { if (Properties.RESET_STATIC_FINAL_FIELDS) { if (Modifier.isFinal(field.getModifiers())) { return true; } else { String fieldName = field.getName(); final boolean isModifiedStaticField = ModifiedTargetStaticFields.getInstance().containsField(fieldName); return isModifiedStaticField; } } else { final boolean isFinalField = Modifier.isFinal(field.getModifiers()); return isFinalField; } }