Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8327476: Upgrade JLine to 3.26.1 #3010

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2018, the original author or authors.
* Copyright (c) 2002-2018, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -66,7 +66,7 @@ public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local, boolean block) {
T o = null;
int[] remaining = new int[1];
boolean hasRead = false;
for (;;) {
for (; ; ) {
if (local != null) {
o = local.getBound(opBuffer, remaining);
}
Expand All @@ -78,8 +78,7 @@ public <T> T readBinding(KeyMap<T> keys, KeyMap<T> local, boolean block) {
if (remaining[0] >= 0) {
runMacro(opBuffer.substring(opBuffer.length() - remaining[0]));
opBuffer.setLength(opBuffer.length() - remaining[0]);
}
else {
} else {
long ambiguousTimeout = keys.getAmbiguousTimeout();
if (ambiguousTimeout > 0 && peekCharacter(ambiguousTimeout) != NonBlockingReader.READ_EXPIRED) {
o = null;
Expand Down Expand Up @@ -234,5 +233,4 @@ public String getCurrentBuffer() {
public String getLastBinding() {
return lastBinding;
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2016, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -8,8 +8,6 @@
*/
package jdk.internal.org.jline.keymap;

import java.io.IOException;
import java.io.StringWriter;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
Expand Down Expand Up @@ -218,7 +216,6 @@ public static Collection<String> range(String range) {
return seqs;
}


public static String esc() {
return "\033";
}
Expand Down Expand Up @@ -264,7 +261,6 @@ public static String key(Terminal terminal, Capability capability) {
// Methods
//


public T getUnicode() {
return unicode;
}
Expand Down Expand Up @@ -306,9 +302,7 @@ private static <T> void doGetBoundKeys(KeyMap<T> keyMap, String prefix, Map<Stri
}
for (int c = 0; c < keyMap.mapping.length; c++) {
if (keyMap.mapping[c] instanceof KeyMap) {
doGetBoundKeys((KeyMap<T>) keyMap.mapping[c],
prefix + (char) (c),
bound);
doGetBoundKeys((KeyMap<T>) keyMap.mapping[c], prefix + (char) (c), bound);
} else if (keyMap.mapping[c] != null) {
bound.put(prefix + (char) (c), (T) keyMap.mapping[c]);
}
Expand Down Expand Up @@ -456,5 +450,4 @@ private static <T> void bind(KeyMap<T> map, CharSequence keySeq, T function, boo
}
}
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2016, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -14,9 +14,8 @@
* @see Macro
* @see Reference
* @see Widget
* @see jdk.internal.org.jline.keymap.KeyMap
* @see org.jline.keymap.KeyMap
*
* @author <a href="mailto:[email protected]">Guillaume Nodet</a>
*/
public interface Binding {
}
public interface Binding {}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2017, the original author or authors.
* Copyright (c) 2002-2017, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -84,4 +84,8 @@ public interface Buffer {

void copyFrom(Buffer buffer);

/**
* Clear any internal buffer.
*/
void zeroOut();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2019, the original author or authors.
* Copyright (c) 2002-2019, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -47,7 +47,15 @@ public Candidate(String value) {
* @param complete the complete flag
* @param sort the sort flag
*/
public Candidate(String value, String displ, String group, String descr, String suffix, String key, boolean complete, int sort) {
public Candidate(
String value,
String displ,
String group,
String descr,
String suffix,
String key,
boolean complete,
int sort) {
this.value = Objects.requireNonNull(value);
this.displ = Objects.requireNonNull(displ);
this.group = group;
Expand All @@ -69,7 +77,8 @@ public Candidate(String value, String displ, String group, String descr, String
* @param key the key
* @param complete the complete flag
*/
public Candidate(String value, String displ, String group, String descr, String suffix, String key, boolean complete) {
public Candidate(
String value, String displ, String group, String descr, String suffix, String key, boolean complete) {
this(value, displ, group, descr, suffix, key, complete, 0);
}

Expand Down Expand Up @@ -159,11 +168,10 @@ public int sort() {
return sort;
}


@Override
public int compareTo(Candidate o) {
// If both candidates have same sort, use default behavior
if( sort == o.sort() ) {
if (sort == o.sort()) {
return value.compareTo(o.value);
} else {
return Integer.compare(sort, o.sort());
Expand All @@ -180,7 +188,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(value);
return Objects.hashCode(value);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2018, the original author or authors.
* Copyright (c) 2002-2018, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -18,8 +18,7 @@
* @author <a href="mailto:[email protected]">Guillaume Nodet</a>
* @since 2.3
*/
public interface Completer
{
public interface Completer {
/**
* Populates <i>candidates</i> with a list of possible completions for the <i>command line</i>.
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2018, the original author or authors.
* Copyright (c) 2002-2018, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -10,7 +10,7 @@

/**
* An extension of {@link ParsedLine} that, being aware of the quoting and escaping rules
* of the {@link jdk.internal.org.jline.reader.Parser} that produced it, knows if and how a completion candidate
* of the {@link org.jline.reader.Parser} that produced it, knows if and how a completion candidate
* should be escaped/quoted.
*
* @author Eric Bottard
Expand All @@ -22,5 +22,4 @@ public interface CompletingParsedLine extends ParsedLine {
int rawWordCursor();

int rawWordLength();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2020, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -23,8 +23,13 @@ public interface CompletionMatcher {
* @param errors number of errors accepted in matching
* @param originalGroupName value of JLineReader variable original-group-name
*/
void compile(Map<LineReader.Option, Boolean> options, boolean prefix, CompletingParsedLine line
, boolean caseInsensitive, int errors, String originalGroupName);
void compile(
Map<LineReader.Option, Boolean> options,
boolean prefix,
CompletingParsedLine line,
boolean caseInsensitive,
int errors,
String originalGroupName);

/**
*
Expand All @@ -44,5 +49,4 @@ void compile(Map<LineReader.Option, Boolean> options, boolean prefix, Completing
* @return a common prefix of matched candidates
*/
String getCommonPrefix();

}
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* Copyright (c) 2023, the original author(s).
*
* http://www.apache.org/licenses/LICENSE-2.0
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
* https://opensource.org/licenses/BSD-3-Clause
*/
package jdk.internal.org.jline.reader;

Expand Down Expand Up @@ -45,7 +35,7 @@ public String getMissing() {
return missing;
}

public int getOpenBrackets(){
public int getOpenBrackets() {
return openBrackets;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2019, the original author or authors.
* Copyright (c) 2002-2019, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -13,6 +13,8 @@

public interface Editor {
public void open(List<String> files) throws IOException;

public void run() throws IOException;

public void setRestricted(boolean restricted);
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2020, the original author or authors.
* Copyright (c) 2002-2020, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -17,8 +17,7 @@ public class EndOfFileException extends RuntimeException {
private static final long serialVersionUID = 528485360925144689L;
private String partialLine;

public EndOfFileException() {
}
public EndOfFileException() {}

public EndOfFileException(String message) {
super(message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2016, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -13,5 +13,4 @@ public interface Expander {
String expandHistory(History history, String line);

String expandVar(String word);

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2021, the original author or authors.
* Copyright (c) 2002-2021, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2018, the original author or authors.
* Copyright (c) 2002-2018, the original author(s).
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand All @@ -21,8 +21,7 @@
* @author <a href="mailto:[email protected]">Jason Dillon</a>
* @since 2.3
*/
public interface History extends Iterable<History.Entry>
{
public interface History extends Iterable<History.Entry> {

/**
* Initialize the history for the given reader.
Expand Down Expand Up @@ -75,7 +74,6 @@ public interface History extends Iterable<History.Entry>
*/
void purge() throws IOException;


int size();

default boolean isEmpty() {
Expand Down Expand Up @@ -110,8 +108,7 @@ default boolean isPersistable(Entry entry) {
// Entries
//

interface Entry
{
interface Entry {
int index();

Instant time();
Expand All @@ -132,14 +129,17 @@ default Iterator<Entry> reverseIterator() {
default Iterator<Entry> reverseIterator(int index) {
return new Iterator<Entry>() {
private final ListIterator<Entry> it = iterator(index + 1);

@Override
public boolean hasNext() {
return it.hasPrevious();
}

@Override
public Entry next() {
return it.previous();
}

@Override
public void remove() {
it.remove();
Expand Down
Loading