Skip to content

Commit efb83fa

Browse files
committed
Prevent duplicated logs in ConstantFieldSubstitutionProcessor
See gh-28624
1 parent f8508c8 commit efb83fa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

spring-core/graalvm/src/main/java/org/springframework/aot/graalvm/ConstantFieldSubstitutionProcessor.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717
package org.springframework.aot.graalvm;
1818

1919
import java.lang.reflect.Field;
20+
import java.util.LinkedHashSet;
21+
import java.util.Set;
2022
import java.util.regex.Pattern;
2123

2224
import com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor;
@@ -47,6 +49,8 @@ class ConstantFieldSubstitutionProcessor extends SubstitutionProcessor {
4749

4850
private final ThrowawayClassLoader throwawayClassLoader;
4951

52+
private Set<String> seen = new LinkedHashSet<>();
53+
5054

5155
ConstantFieldSubstitutionProcessor(DebugContext debug, ClassLoader applicationClassLoader) {
5256
this.throwawayClassLoader = new ThrowawayClassLoader(applicationClassLoader);
@@ -63,7 +67,10 @@ public ResolvedJavaField lookup(ResolvedJavaField field) {
6367
JavaConstant constant = lookupConstant(declaringClass.toJavaName(), field.getName());
6468
if (constant != null) {
6569
// TODO Use proper logging only when --verbose is specified when https://github.com/oracle/graal/issues/4669 will be fixed
66-
System.out.println("Field " + fieldIdentifier + " set to " + constant.toValueString() + " at build time");
70+
if (!this.seen.contains(fieldIdentifier)) {
71+
this.seen.add(fieldIdentifier);
72+
System.out.println("Field " + fieldIdentifier + " set to " + constant.toValueString() + " at build time");
73+
}
6774
return new ConstantReadableJavaField(field, constant);
6875
}
6976
}

0 commit comments

Comments
 (0)