This is an automated email from the ASF dual-hosted git repository. paulk pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/groovy.git
commit bc47218260cbe0962814f7048b75f66522c325f5 Author: Paul King <[email protected]> AuthorDate: Fri Mar 27 16:32:18 2026 +1000 minor refactor: hush deprecation warnings with some changed classes in jline3 until we migrate --- .../src/main/groovy/org/apache/groovy/groovysh/Main.groovy | 1 + .../org/apache/groovy/groovysh/jline/GroovyEngine.java | 5 ++--- .../org/apache/groovy/groovysh/jline/SystemRegistryImpl.java | 12 ++++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy index f28a5047e6..ff8feab505 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/Main.groovy @@ -79,6 +79,7 @@ import static org.jline.jansi.AnsiRenderer.render /** * Groovy Repo modelled on JLine3 Groovy Repl demo */ +@SuppressWarnings('deprecation') class Main { private static final MessageSource messages = new MessageSource(Main) public static final String INTERPRETER_MODE_PREFERENCE_KEY = 'interpreterMode' diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java index 4c5bcdaa2c..8b9c8ca1c5 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/GroovyEngine.java @@ -79,13 +79,12 @@ import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import static org.jline.console.ConsoleEngine.VAR_NANORC; - /** * Implements Groovy ScriptEngine. * You must be very careful when using GroovyEngine in a multithreaded environment. The Binding instance is not * thread safe, and it is shared by all scripts. */ +@SuppressWarnings("deprecation") public class GroovyEngine implements ScriptEngine { public enum Format { JSON, @@ -767,7 +766,7 @@ public class GroovyEngine implements ScriptEngine { protected SyntaxHighlighter getSyntaxHighlighter() { String syntax = groovyOption(NANORC_SYNTAX, DEFAULT_NANORC_SYNTAX); if (syntaxHighlighter == null || syntax == null || !syntax.equals(syntaxHighlighterStyle)) { - String nanorcString = (String) get(VAR_NANORC); + String nanorcString = (String) get("NANORC"); Path nanorc = nanorcString != null ? Paths.get(nanorcString) : null; if (syntax == null) { syntaxHighlighter = SyntaxHighlighter.build(""); diff --git a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/SystemRegistryImpl.java b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/SystemRegistryImpl.java index 321394d4da..f77b5daaa3 100644 --- a/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/SystemRegistryImpl.java +++ b/subprojects/groovy-groovysh/src/main/groovy/org/apache/groovy/groovysh/jline/SystemRegistryImpl.java @@ -30,7 +30,6 @@ import org.jline.builtins.Options; import org.jline.builtins.Options.HelpException; import org.jline.builtins.Styles; import org.jline.console.*; -import org.jline.console.ConsoleEngine.ExecutionResult; import org.jline.console.impl.Builtins; import org.jline.console.impl.ConsoleEngineImpl; import org.jline.console.impl.JlineCommandRegistry; @@ -47,6 +46,7 @@ import org.jline.utils.*; /** * Aggregate command registries. */ +@SuppressWarnings("deprecation") public class SystemRegistryImpl implements SystemRegistry { // NOTE: This file can be deleted if the following PRs are merged: // https://github.com/jline/jline3/pull/1392 @@ -1295,7 +1295,7 @@ public class SystemRegistryImpl implements SystemRegistry { if (cmd.pipe().equals(pipeName.get(Pipe.PIPE)) && out == null) { out = outputStream.output; } - ExecutionResult er = postProcess(cmd, statement, consoleEngine, out); + ConsoleEngine.ExecutionResult er = postProcess(cmd, statement, consoleEngine, out); postProcessed = true; consoleEngine.println(er.result()); out = null; @@ -1329,16 +1329,16 @@ public class SystemRegistryImpl implements SystemRegistry { return out; } - private ExecutionResult postProcess( + private ConsoleEngine.ExecutionResult postProcess( CommandData cmd, boolean statement, ConsoleEngine consoleEngine, Object result) { - ExecutionResult out; + ConsoleEngine.ExecutionResult out; if (cmd.file() != null) { int status = 1; if (cmd.file().exists()) { long delta = new Date().getTime() - cmd.file().lastModified(); status = delta < 100 ? 0 : 1; } - out = new ExecutionResult(status, result); + out = new ConsoleEngine.ExecutionResult(status, result); } else if (!statement) { outputStream.close(); out = consoleEngine.postProcess(cmd.rawLine(), result, outputStream.getOutput()); @@ -1348,7 +1348,7 @@ public class SystemRegistryImpl implements SystemRegistry { } else { out = consoleEngine.postProcess(result); } - out = new ExecutionResult(out.status(), null); + out = new ConsoleEngine.ExecutionResult(out.status(), null); } else { out = consoleEngine.postProcess(result); }
