Skip to content

Commit

Permalink
Support building on JDK 21
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Aug 3, 2023
1 parent ffd0de4 commit 05ee05d
Show file tree
Hide file tree
Showing 28 changed files with 48 additions and 10 deletions.
1 change: 1 addition & 0 deletions builtins/src/main/java/org/jline/builtins/Completers.java
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ public TreeCompleter(Node... nodes) {
this(Arrays.asList(nodes));
}

@SuppressWarnings("this-escape")
public TreeCompleter(List<Node> nodes) {
StringBuilder sb = new StringBuilder();
addRoots(sb, nodes);
Expand Down
1 change: 1 addition & 0 deletions builtins/src/main/java/org/jline/builtins/Nano.java
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,7 @@ public Nano(Terminal terminal, Path root, Options opts) {
this(terminal, root, opts, null);
}

@SuppressWarnings("this-escape")
public Nano(Terminal terminal, Path root, Options opts, ConfigurationPath configPath) {
this.terminal = terminal;
this.windowsTerminal = terminal.getClass().getSimpleName().endsWith("WinSysTerminal");
Expand Down
1 change: 1 addition & 0 deletions builtins/src/main/java/org/jline/builtins/Tmux.java
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ public void resizePane(Options opt, int adjust) {
}
}

@SuppressWarnings("this-escape")
public Tmux(Terminal terminal, PrintStream err, Consumer<Terminal> runner) throws IOException {
this.terminal = terminal;
this.err = err;
Expand Down
1 change: 1 addition & 0 deletions console/src/main/java/org/jline/console/impl/Builtins.java
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public Builtins(Supplier<Path> workDir, ConfigurationPath configPath, Function<S
this(null, workDir, configPath, widgetCreator);
}

@SuppressWarnings("this-escape")
public Builtins(
Set<Command> commands,
Supplier<Path> workDir,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public ConsoleEngineImpl(ScriptEngine engine, Printer printer, Supplier<Path> wo
this(null, engine, printer, workDir, configPath);
}

@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked", "this-escape"})
public ConsoleEngineImpl(
Set<Command> commands,
ScriptEngine engine,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public enum Pipe {
private boolean commandGroups = true;
private Function<CmdLine, CmdDesc> scriptDescription;

@SuppressWarnings("this-escape")
public SystemRegistryImpl(Parser parser, Terminal terminal, Supplier<Path> workDir, ConfigurationPath configPath) {
this.parser = parser;
this.workDir = workDir;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public AutopairWidgets(LineReader reader) {
this(reader, false);
}

@SuppressWarnings("this-escape")
public AutopairWidgets(LineReader reader, boolean addCurlyBrackets) {
super(reader);
if (existsWidget(AP_INSERT)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
public class AutosuggestionWidgets extends Widgets {
private boolean enabled = false;

@SuppressWarnings("this-escape")
public AutosuggestionWidgets(LineReader reader) {
super(reader);
if (existsWidget("_autosuggest-forward-char")) {
Expand Down
1 change: 1 addition & 0 deletions console/src/main/java/org/jline/widget/TailTipWidgets.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ public TailTipWidgets(LineReader reader, Function<CmdLine, CmdDesc> descFun, int
this(reader, null, descriptionSize, tipType, descFun);
}

@SuppressWarnings("this-escape")
private TailTipWidgets(
LineReader reader,
Map<String, CmdDesc> tailTips,
Expand Down
1 change: 1 addition & 0 deletions groovy/src/main/java/org/jline/script/GroovyCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public GroovyCommand(GroovyEngine engine, Printer printer) {
this(null, engine, printer);
}

@SuppressWarnings("this-escape")
public GroovyCommand(Set<Command> commands, GroovyEngine engine, Printer printer) {
this.engine = engine;
this.printer = printer;
Expand Down
24 changes: 17 additions & 7 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
<gogo.jline.version>1.1.8</gogo.jline.version>
<slf4j.version>2.0.6</slf4j.version>
<findbugs.version>3.0.2</findbugs.version>
<groovy.version>4.0.7</groovy.version>
<groovy.version>4.0.13</groovy.version>
<ivy.version>2.5.1</ivy.version>
<graal.version>22.3.0</graal.version>
<graal.plugin.version>21.2.0</graal.plugin.version>
Expand Down Expand Up @@ -522,7 +522,7 @@
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.28.0</version>
<version>2.37.0</version>
<configuration>
<java>
<toggleOffOn />
Expand Down Expand Up @@ -684,11 +684,6 @@
<groupId>org.graalvm.nativeimage</groupId>
<artifactId>native-image-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down Expand Up @@ -764,6 +759,21 @@
</build>
</profile>

<profile>
<id>java11</id>
<activation>
<jdk>[11,21)</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</profile>

<profile>
<id>license-check</id>
<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ protected enum BellType {

protected KillRing killRing = new KillRing();

protected UndoTree<Buffer> undo = new UndoTree<>(this::setBuffer);
protected UndoTree<Buffer> undo;
protected boolean isUndo;

/**
Expand Down Expand Up @@ -291,6 +291,7 @@ public LineReaderImpl(Terminal terminal, String appName) throws IOException {
this(terminal, appName, null);
}

@SuppressWarnings("this-escape")
public LineReaderImpl(Terminal terminal, String appName, Map<String, Object> variables) {
Objects.requireNonNull(terminal, "terminal can not be null");
this.terminal = terminal;
Expand All @@ -309,6 +310,7 @@ public LineReaderImpl(Terminal terminal, String appName, Map<String, Object> var
this.alternateOut = Curses.tputs(terminal.getStringCapability(Capability.exit_alt_charset_mode));
}

undo = new UndoTree<>(this::setBuffer);
builtinWidgets = builtinWidgets();
widgets = new HashMap<>(builtinWidgets);
bindingReader = new BindingReader(terminal.reader());
Expand Down
1 change: 1 addition & 0 deletions reader/src/main/java/org/jline/reader/impl/UndoTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public class UndoTree<T> {
private final Node parent;
private Node current;

@SuppressWarnings("this-escape")
public UndoTree(Consumer<T> s) {
state = s;
parent = new Node(null);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ public class DefaultHistory implements History {

public DefaultHistory() {}

@SuppressWarnings("this-escape")
public DefaultHistory(LineReader reader) {
attach(reader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class ConnectionData {
* @param sock Socket of the inbound connection.
* @param cm the connection manager
*/
@SuppressWarnings("this-escape")
public ConnectionData(Socket sock, ConnectionManager cm) {
socket = sock;
connectionManager = cm;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public abstract class ConnectionManager implements Runnable {
private boolean lineMode = false;
private boolean stopping = false;

@SuppressWarnings("this-escape")
public ConnectionManager() {
threadGroup = new ThreadGroup(toString() + "Connections");
closedConnections = new Stack<Connection>();
Expand Down
1 change: 1 addition & 0 deletions terminal/src/main/java/org/jline/terminal/Attributes.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ public enum LocalFlag {

public Attributes() {}

@SuppressWarnings("this-escape")
public Attributes(Attributes attr) {
copy(attr);
}
Expand Down
1 change: 1 addition & 0 deletions terminal/src/main/java/org/jline/terminal/Size.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class Size {

public Size() {}

@SuppressWarnings("this-escape")
public Size(int columns, int rows) {
this();
setColumns(columns);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,21 @@ public abstract class AbstractTerminal implements Terminal {
protected final Set<Capability> bools = new HashSet<>();
protected final Map<Capability, Integer> ints = new HashMap<>();
protected final Map<Capability, String> strings = new HashMap<>();
protected final ColorPalette palette = new ColorPalette(this);
protected final ColorPalette palette;
protected Status status;
protected Runnable onClose;

public AbstractTerminal(String name, String type) throws IOException {
this(name, type, null, SignalHandler.SIG_DFL);
}

@SuppressWarnings("this-escape")
public AbstractTerminal(String name, String type, Charset encoding, SignalHandler signalHandler)
throws IOException {
this.name = name;
this.type = type != null ? type : "ansi";
this.encoding = encoding != null ? encoding : Charset.defaultCharset();
this.palette = new ColorPalette(this);
for (Signal signal : Signal.values()) {
handlers.put(signal, signalHandler);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ public abstract class AbstractWindowsTerminal<Console> extends AbstractTerminal
protected boolean focusTracking = false;
private volatile boolean closing;

@SuppressWarnings("this-escape")
public AbstractWindowsTerminal(
Writer writer,
String name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public DumbTerminal(String name, String type, InputStream in, OutputStream out,
this(name, type, in, out, encoding, SignalHandler.SIG_DFL);
}

@SuppressWarnings("this-escape")
public DumbTerminal(
String name, String type, InputStream in, OutputStream out, Charset encoding, SignalHandler signalHandler)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public ExternalTerminal(
this(name, type, masterInput, masterOutput, encoding, signalHandler, paused, null, null);
}

@SuppressWarnings("this-escape")
public ExternalTerminal(
String name,
String type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public LineDisciplineTerminal(String name, String type, OutputStream masterOutpu
this(name, type, masterOutput, encoding, SignalHandler.SIG_DFL);
}

@SuppressWarnings("this-escape")
public LineDisciplineTerminal(
String name, String type, OutputStream masterOutput, Charset encoding, SignalHandler signalHandler)
throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public PosixPtyTerminal(
this(name, type, pty, in, out, encoding, signalHandler, false);
}

@SuppressWarnings("this-escape")
public PosixPtyTerminal(
String name,
String type,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public class PosixSysTerminal extends AbstractPosixTerminal {
protected final Map<Signal, Object> nativeHandlers = new HashMap<>();
protected final Task closer;

@SuppressWarnings("this-escape")
public PosixSysTerminal(
String name, String type, Pty pty, Charset encoding, boolean nativeSignals, SignalHandler signalHandler)
throws IOException {
Expand Down
1 change: 1 addition & 0 deletions terminal/src/main/java/org/jline/utils/ColorPalette.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public ColorPalette(Terminal terminal) throws IOException {
this(terminal, null);
}

@SuppressWarnings("this-escape")
public ColorPalette(Terminal terminal, String distance) throws IOException {
this.terminal = terminal;
this.distanceName = distance;
Expand Down
1 change: 1 addition & 0 deletions terminal/src/main/java/org/jline/utils/Display.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public class Display {
protected final boolean delayedWrapAtEol;
protected final boolean cursorDownIsNewLine;

@SuppressWarnings("this-escape")
public Display(Terminal terminal, boolean fullscreen) {
this.terminal = terminal;
this.fullScreen = fullscreen;
Expand Down
1 change: 1 addition & 0 deletions terminal/src/main/java/org/jline/utils/Status.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public static Status getStatus(Terminal terminal, boolean create) {
return terminal instanceof AbstractTerminal ? ((AbstractTerminal) terminal).getStatus(create) : null;
}

@SuppressWarnings("this-escape")
public Status(AbstractTerminal terminal) {
this.terminal = Objects.requireNonNull(terminal, "terminal can not be null");
this.supported = terminal.getStringCapability(Capability.change_scroll_region) != null
Expand Down

0 comments on commit 05ee05d

Please sign in to comment.