diff --git a/build.sbt b/build.sbt index 4bf056b0..dc3bcc04 100644 --- a/build.sbt +++ b/build.sbt @@ -27,7 +27,14 @@ ThisBuild / dynverSeparator := "-" ThisBuild / scalaVersion := "2.12.11" // For building jars for JDK8 -ThisBuild / javacOptions ++= Seq("-source", "1.8", "-target", "1.8") +ThisBuild / javacOptions ++= { + if (scala.util.Properties.isJavaAtLeast("9")) { + // --release 8 option is not available in JDK8 + Seq("--release", "8") + } else { + Seq.empty + } +} Compile / compile / javacOptions ++= Seq("-encoding", "UTF-8", "-Xlint:unchecked", "-Xlint:deprecation") doc / javacOptions := { diff --git a/src/main/java/org/xerial/snappy/Snappy.java b/src/main/java/org/xerial/snappy/Snappy.java index 0c2815f0..5263e94b 100755 --- a/src/main/java/org/xerial/snappy/Snappy.java +++ b/src/main/java/org/xerial/snappy/Snappy.java @@ -28,6 +28,7 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import java.net.URL; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.nio.charset.Charset; import java.util.Properties; @@ -154,7 +155,7 @@ public static int compress(ByteBuffer uncompressed, ByteBuffer compressed) // pos limit // [ ......BBBBBBB.........] - compressed.limit(cPos + compressedSize); + ((Buffer) compressed).limit(cPos + compressedSize); return compressedSize; }