Skip to content

Commit

Permalink
Fix remaining jdk 9 calls and use animal-sniffer to check signatures
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet committed Oct 31, 2023
1 parent f63a20f commit 220ed4d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 3 deletions.
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@
<graal.plugin.version>21.2.0</graal.plugin.version>

<surefire.argLine>--add-opens java.base/java.io=ALL-UNNAMED</surefire.argLine>

<animal-sniffer.skip>false</animal-sniffer.skip>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -713,6 +715,36 @@
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.23</version>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>9.6</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
<skip>${animal-sniffer.skip}</skip>
<ignoreDependencies>true</ignoreDependencies>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
1 change: 1 addition & 0 deletions terminal-ffm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<properties>
<java.target.version>21</java.target.version>
<automatic.module.name>org.jline.terminal.ffm</automatic.module.name>
<animal-sniffer.skip>true</animal-sniffer.skip>
</properties>

<dependencies>
Expand Down
4 changes: 4 additions & 0 deletions terminal/src/main/java/org/jline/utils/NonBlocking.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,4 +244,8 @@ static void clear(Buffer buffer) {
static void flip(Buffer buffer) {
buffer.flip();
}

static void rewind(Buffer buffer) {
buffer.rewind();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static boolean rewind(ByteBuffer buffer, ByteBuffer other) {
}
// If we have reached the end of the buffer, rewind and set the new limit
if (buffer.position() == buffer.capacity()) {
buffer.rewind();
NonBlocking.rewind(buffer);
limit(buffer, other.position());
return true;
} else {
Expand Down
2 changes: 1 addition & 1 deletion terminal/src/main/java/org/jline/utils/PumpReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static boolean rewind(CharBuffer buffer, CharBuffer other) {

// If we have reached the end of the buffer, rewind and set the new limit
if (buffer.position() == buffer.capacity()) {
buffer.rewind();
NonBlocking.rewind(buffer);
limit(buffer, other.position());
return true;
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.nio.charset.CodingErrorAction;

import static org.jline.utils.NonBlocking.flip;
import static org.jline.utils.NonBlocking.rewind;

/**
* Redirects an {@link OutputStream} to a {@link Writer} by decoding the data
Expand Down Expand Up @@ -118,7 +119,7 @@ private void processInput(final boolean endOfInput) throws IOException {
private void flushOutput() throws IOException {
if (decoderOut.position() > 0) {
out.write(decoderOut.array(), 0, decoderOut.position());
decoderOut.rewind();
rewind(decoderOut);
}
}
}

0 comments on commit 220ed4d

Please sign in to comment.