2222
2323import com .google .gson .annotations .Expose ;
2424import io .github .notenoughupdates .moulconfig .Config ;
25- import io .github .notenoughupdates .moulconfig .annotations .*;
25+ import io .github .notenoughupdates .moulconfig .annotations .Accordion ;
26+ import io .github .notenoughupdates .moulconfig .annotations .Category ;
27+ import io .github .notenoughupdates .moulconfig .annotations .ConfigAccordionId ;
28+ import io .github .notenoughupdates .moulconfig .annotations .ConfigEditorAccordion ;
29+ import io .github .notenoughupdates .moulconfig .annotations .ConfigEditorButton ;
30+ import io .github .notenoughupdates .moulconfig .annotations .ConfigEditorInfoText ;
31+ import io .github .notenoughupdates .moulconfig .annotations .ConfigOption ;
2632import io .github .notenoughupdates .moulconfig .internal .BoundField ;
2733import io .github .notenoughupdates .moulconfig .internal .Warnings ;
2834import lombok .var ;
2935
3036import java .lang .annotation .Annotation ;
3137import java .lang .reflect .Field ;
3238import java .lang .reflect .Modifier ;
33- import java .util .*;
39+ import java .util .ArrayList ;
40+ import java .util .Arrays ;
41+ import java .util .HashSet ;
42+ import java .util .List ;
43+ import java .util .Set ;
44+ import java .util .Stack ;
3445
3546public class ConfigProcessorDriver {
3647 private final List <Class <? extends Annotation >> nonStoredConfigOptions = Arrays .asList (
@@ -40,6 +51,8 @@ public class ConfigProcessorDriver {
4051
4152 public final ConfigStructureReader reader ;
4253
54+ public boolean warnForPrivateFields = true ;
55+
4356 public int nextAnnotation = 1000000000 ;
4457
4558 public boolean checkExpose = true ;
@@ -67,14 +80,15 @@ public void processCategory(Object categoryObject,
6780 ConfigOption optionAnnotation = field .getAnnotation (ConfigOption .class );
6881 if (optionAnnotation == null ) continue ;
6982 if (checkExpose && field .getAnnotation (Expose .class ) == null
70- && (field .getModifiers () & Modifier .TRANSIENT ) == 0
71- && nonStoredConfigOptions .stream ().noneMatch (field ::isAnnotationPresent )) {
83+ && (field .getModifiers () & Modifier .TRANSIENT ) == 0
84+ && nonStoredConfigOptions .stream ().noneMatch (field ::isAnnotationPresent )) {
7285 Warnings .warn ("Non transient @ConfigOption without @Expose in " + categoryClass + " on field " + field );
7386 }
7487
7588 if ((field .getModifiers () & Modifier .PUBLIC ) != Modifier .PUBLIC ) {
7689 field .setAccessible (true );
77- Warnings .warn ("@ConfigOption on non public field " + field + " in " + categoryClass );
90+ if (warnForPrivateFields )
91+ Warnings .warn ("@ConfigOption on non public field " + field + " in " + categoryClass );
7892 }
7993
8094 ConfigAccordionId parentAccordion = field .getAnnotation (ConfigAccordionId .class );
@@ -146,7 +160,8 @@ private void processCategoryMeta(
146160 }
147161 if ((categoryField .getModifiers () & Modifier .PUBLIC ) != Modifier .PUBLIC ) {
148162 categoryField .setAccessible (true );
149- Warnings .warn ("@Category on non public field " + categoryField + " in " + parent .getClass ());
163+ if (warnForPrivateFields )
164+ Warnings .warn ("@Category on non public field " + categoryField + " in " + parent .getClass ());
150165 }
151166 var deferredSubCategories = new ArrayList <BoundField >();
152167 reader .beginCategory (parent , categoryField , categoryAnnotation .name (), categoryAnnotation .desc ());
0 commit comments