@@ -23,7 +23,16 @@ public final class StaticConstants {
2323 private StaticConstants () {
2424 }
2525
26- /** Resolve a Spoon field reference to its compile-time constant value, source AST first then reflection. */
26+ /**
27+ * Resolve a Spoon {@code static final} field reference to its compile-time value, so reads like
28+ * {@code Integer.MAX_VALUE} or {@code MyConfig.LIMIT} fold to literals before SMT translation.
29+ *
30+ * <p>Tries the source AST first ({@link CtLiteral} initializer in Spoon's model), then reflection via
31+ * {@link CtFieldReference#getActualField()} + {@link #readStaticFinal}. Returns {@code null} if the field
32+ * isn't static-final, has a non-literal initializer, or any lookup step fails.
33+ *
34+ * @see #resolve(String, String, CtElement) sibling for refinement-string {@code Type.CONST} references
35+ */
2736 public static Object resolve (CtFieldReference <?> ref ) {
2837 if (!ref .isStatic () || !ref .isFinal ())
2938 return null ;
@@ -132,6 +141,15 @@ public static Predicate asLiteralPredicate(Object value) {
132141 return null ;
133142 }
134143
144+ /**
145+ * Reflectively read {@code className.fieldName} as a {@code public static final} constant — e.g.
146+ * {@code lookup("java.lang.Integer", "MAX_VALUE")} returns {@code 2147483647}, which is how
147+ * {@code Integer.MAX_VALUE} gets baked into the AST before SMT translation.
148+ *
149+ * <p>Returns {@code null} on any failure ({@link ClassNotFoundException}, {@link NoSuchFieldException},
150+ * {@link LinkageError}, {@link SecurityException}, or non-static-final) so callers can fall through to the
151+ * next resolution strategy without a try/catch. Only public fields are visible to {@link Class#getField}.
152+ */
135153 private static Object lookup (String className , String fieldName ) {
136154 try {
137155 return readStaticFinal (Class .forName (className ).getField (fieldName ));
0 commit comments