diff --git a/kernel/src/main/java/org/kframework/kserver/KServerFrontEnd.java b/kernel/src/main/java/org/kframework/kserver/KServerFrontEnd.java index 3b3017d8b5f..b1ea8a48939 100644 --- a/kernel/src/main/java/org/kframework/kserver/KServerFrontEnd.java +++ b/kernel/src/main/java/org/kframework/kserver/KServerFrontEnd.java @@ -147,10 +147,10 @@ public int run(String tool, String[] args, File workingDir, Map requestScope.enter(); Main.seedInjector(requestScope, tool, args, workingDir, env, startTime); TTYInfo tty = injector.getInstance(TTYInfo.class); - if (!tty.stdout) { + if (!tty.stdout()) { system_out.init(new PrintStream(system_out.getPrintStream())); } - if (!tty.stderr) { + if (!tty.stderr()) { system_err.init(new PrintStream(system_err.getPrintStream())); } diff --git a/kernel/src/main/java/org/kframework/unparser/KPrint.java b/kernel/src/main/java/org/kframework/unparser/KPrint.java index ee9882e9f76..a1941400bba 100644 --- a/kernel/src/main/java/org/kframework/unparser/KPrint.java +++ b/kernel/src/main/java/org/kframework/unparser/KPrint.java @@ -121,11 +121,11 @@ public void prettyPrint(Definition def, Module module, Consumer print, K } public void prettyPrint(Definition def, Module module, Consumer print, K result, Sort s) { - print.accept(prettyPrint(def, module, result, s, options.color(tty.stdout, files.getEnv()), options.output)); + print.accept(prettyPrint(def, module, result, s, options.color(tty.stdout(), files.getEnv()), options.output)); } public byte[] prettyPrint(Definition def, Module module, K result) { - return prettyPrint(def, module, result, Sorts.GeneratedTopCell(), options.color(tty.stdout, files.getEnv()), options.output); + return prettyPrint(def, module, result, Sorts.GeneratedTopCell(), options.color(tty.stdout(), files.getEnv()), options.output); } public byte[] prettyPrint(Definition def, Module module, K orig, Sort s, ColorSetting colorize, OutputModes outputMode) { @@ -182,7 +182,7 @@ public static byte[] serialize(K term, OutputModes outputMode) { } public String unparseTerm(K input, Module test) { - return unparseTerm(input, test, options.color(tty.stdout, files.getEnv())); + return unparseTerm(input, test, options.color(tty.stdout(), files.getEnv())); } public String unparseTerm(K input, Module test, ColorSetting colorize) { diff --git a/kernel/src/main/java/org/kframework/utils/file/TTYInfo.java b/kernel/src/main/java/org/kframework/utils/file/TTYInfo.java index b88d0ccdb42..c0a9f6cc016 100644 --- a/kernel/src/main/java/org/kframework/utils/file/TTYInfo.java +++ b/kernel/src/main/java/org/kframework/utils/file/TTYInfo.java @@ -6,16 +6,7 @@ * connected to terminals. Essentially, each boolean in this class is * true if and only if the corresponding stream is one for which * ultimately the isatty function returns true. - * @author dwightguth * + * @author dwightguth */ -public class TTYInfo { - - public final boolean stdin, stdout, stderr; - - public TTYInfo(boolean stdin, boolean stdout, boolean stderr) { - this.stdin = stdin; - this.stdout = stdout; - this.stderr = stderr; - } -} +public record TTYInfo(boolean stdin, boolean stdout, boolean stderr) {}