gnodet-bot commented on code in PR #13832:
URL: https://github.com/apache/maven/pull/13832#discussion_r4551114954
##########
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);
private final InjectorDiagnostics diagnostics = new
InjectorDiagnostics(this, bindings, scopes);
private int registrationDepth;
public InjectorImpl() {
bindScope(Singleton.class, new SingletonScope());
}
+ public void setDumpSink(Consumer<String> dumpSink) {
+ this.dumpSink = dumpSink != null ? dumpSink : s -> {};
+ }
Review Comment:
⚠️ **Missing Javadoc on public `setDumpSink()`** — document that `null` maps
to no-op and that this method must be called before concurrent use.
```suggestion
/**
* Replaces the sink that receives formatted DI-diagnostic blocks.
* Passing {@code null} installs a no-op sink that silently discards
output.
* <p>
* This method is <em>not</em> thread-safe: call it only during
construction,
* before the injector is shared with other threads.
*
* @param dumpSink the new sink, or {@code null} to disable output
*/
public void setDumpSink(Consumer<String> dumpSink) {
this.dumpSink = dumpSink != null ? dumpSink : 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]