gnodet-bot commented on code in PR #13990:
URL: https://github.com/apache/maven/pull/13990#discussion_r4585409835
##########
impl/maven-jline/src/main/java/org/apache/maven/jline/MessageUtils.java:
##########
@@ -18,62 +18,76 @@
*/
package org.apache.maven.jline;
+import java.io.IOException;
+import java.io.UncheckedIOException;
import java.util.function.Consumer;
+import org.apache.maven.api.Constants;
import org.apache.maven.api.services.MessageBuilder;
import org.apache.maven.api.services.MessageBuilderFactory;
import org.jline.jansi.AnsiConsole;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;
+import org.jline.terminal.impl.DeferredTerminal;
+import org.jline.utils.OSUtils;
public class MessageUtils {
+ private static final int SIGINT_EXIT_CODE = 130;
+
static Terminal terminal;
- static LineReader reader;
+ static volatile LineReader reader;
static MessageBuilderFactory messageBuilderFactory = new
JLineMessageBuilderFactory();
- static boolean colorEnabled = true;
+ static Boolean colorEnabled;
Review Comment:
🔍 **Minor: `colorEnabled` is not `volatile`, but `reader` is.**
Both fields use the same lazy-init-from-multiple-threads pattern — `reader`
got `volatile` in the previous commit, but `colorEnabled` (changed from
`boolean` to `Boolean`) did not. The race is benign (the main thread always
sees its own writes), but the asymmetry is surprising and could mislead future
maintainers into thinking this field is single-threaded only.
```suggestion
static volatile Boolean colorEnabled;
```
--
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]