Skip to content

Commit

Permalink
Be more lenient with private fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nea89o committed Jan 11, 2024
1 parent ca4ac35 commit 2ffdfdc
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ public static void processCategory(Object categoryObject, Class<?> categoryClass
Warnings.warn("Non transient @ConfigOption without @Expose in " + categoryClass + " on field " + field);
}

if ((field.getModifiers() & Modifier.PUBLIC) != Modifier.PUBLIC) {
field.setAccessible(true);
Warnings.warn("@ConfigOption on non public field " + field + " in " + categoryClass);
}

ConfigOverlay annotation = field.getAnnotation(ConfigOverlay.class);
if (annotation != null) {
reader.emitGuiOverlay(categoryObject, field, optionAnnotation);
Expand Down Expand Up @@ -138,8 +143,8 @@ private static void processCategoryMeta(
Warnings.warn("@Category without @Expose in " + parent.getClass() + " on field " + categoryField);
}
if ((categoryField.getModifiers() & Modifier.PUBLIC) != Modifier.PUBLIC) {
categoryField.setAccessible(true);
Warnings.warn("@Category on non public field " + categoryField + " in " + parent.getClass());
return;
}
var deferredSubCategories = new ArrayList<BoundField>();
reader.beginCategory(parent, categoryField, categoryAnnotation.name(), categoryAnnotation.desc());
Expand Down

0 comments on commit 2ffdfdc

Please sign in to comment.