1
0
mirror of https://github.com/SquidDev-CC/CC-Tweaked synced 2025-08-29 00:32:18 +00:00

Fix issues with building with Java 9+

Fix for NoSuchMethodError when using Java 9+ at build time and Java 8
at runtime.

Fixes #14
This commit is contained in:
parly 2019-10-19 23:58:34 +09:00
parent 9967dc5740
commit 06092cfddd
2 changed files with 6 additions and 4 deletions

View File

@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.ReadableByteChannel; import java.nio.channels.ReadableByteChannel;
import java.nio.channels.SeekableByteChannel; import java.nio.channels.SeekableByteChannel;
@ -124,7 +125,7 @@ public class BinaryReadableHandle extends HandleGeneric
} }
else else
{ {
single.clear(); ((Buffer) single).clear();
int b = m_reader.read( single ); int b = m_reader.read( single );
return b == -1 ? null : new Object[] { single.get( 0 ) & 0xFF }; return b == -1 ? null : new Object[] { single.get( 0 ) & 0xFF };
} }
@ -148,7 +149,7 @@ public class BinaryReadableHandle extends HandleGeneric
boolean readAnything = false; boolean readAnything = false;
while( true ) while( true )
{ {
buf.clear(); ((Buffer) buf).clear();
int r = m_reader.read( buf ); int r = m_reader.read( buf );
if( r == -1 ) break; if( r == -1 ) break;
@ -172,7 +173,7 @@ public class BinaryReadableHandle extends HandleGeneric
boolean readAnything = false, readRc = false; boolean readAnything = false, readRc = false;
while( true ) while( true )
{ {
single.clear(); ((Buffer) single).clear();
int read = m_reader.read( single ); int read = m_reader.read( single );
if( read <= 0 ) if( read <= 0 )
{ {

View File

@ -15,6 +15,7 @@ import dan200.computercraft.shared.util.StringUtil;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import java.io.Closeable; import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.nio.Buffer;
import java.nio.ByteBuffer; import java.nio.ByteBuffer;
import java.nio.channels.FileChannel; import java.nio.channels.FileChannel;
import java.nio.channels.SeekableByteChannel; import java.nio.channels.SeekableByteChannel;
@ -60,7 +61,7 @@ public class BinaryWritableHandle extends HandleGeneric
if( args.length > 0 && args[0] instanceof Number ) if( args.length > 0 && args[0] instanceof Number )
{ {
int number = ((Number) args[0]).intValue(); int number = ((Number) args[0]).intValue();
single.clear(); ((Buffer) single).clear();
single.put( (byte) number ); single.put( (byte) number );
single.flip(); single.flip();