gnodet-bot commented on code in PR #13832:
URL: https://github.com/apache/maven/pull/13832#discussion_r4553131750
##########
impl/maven-di/src/main/java/org/apache/maven/di/impl/InjectorImpl.java:
##########
@@ -67,13 +68,19 @@ public class InjectorImpl implements Injector {
private final Set<String> loadedUrls = new HashSet<>();
private final ThreadLocal<Set<Key<?>>> resolutionStack = new
ThreadLocal<>();
+ private Consumer<String> dumpSink =
+ s -> LoggerManager.get().getLogger("maven.di.diagnostics").info(s);
Review Comment:
💡 **`dumpSink` missing `volatile`** — the field is no longer `final` and
`setDumpSink()` writes it after construction on a potentially different thread
than the reader. Without `volatile`, the JVM is free to cache the stale default
lambda. DI bootstrapping is typically single-threaded so this is low-risk in
practice, but `volatile` makes the contract explicit.
```suggestion
private volatile Consumer<String> dumpSink =
s ->
LoggerManager.get().getLogger("maven.di.diagnostics").info(s);
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]