From 9b029362cdb5fddb9d7e7187ef9a0b891772d174 Mon Sep 17 00:00:00 2001 From: "Thomas E. Enebo" Date: Sat, 13 Apr 2019 20:58:49 -0500 Subject: [PATCH] Fixes #1772. Explicit cast to Buffer to make Java 8 still find proper signature (when compiled with 9+ and specify Java 8 compat level) --- ext/puma_http11/org/jruby/puma/MiniSSL.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ext/puma_http11/org/jruby/puma/MiniSSL.java b/ext/puma_http11/org/jruby/puma/MiniSSL.java index a18c1273..53c75c1b 100644 --- a/ext/puma_http11/org/jruby/puma/MiniSSL.java +++ b/ext/puma_http11/org/jruby/puma/MiniSSL.java @@ -23,6 +23,7 @@ import javax.net.ssl.SSLPeerUnverifiedException; import javax.net.ssl.SSLSession; import java.io.FileInputStream; import java.io.IOException; +import java.nio.Buffer; import java.nio.ByteBuffer; import java.security.KeyManagementException; import java.security.KeyStore; @@ -65,7 +66,7 @@ public class MiniSSL extends RubyObject { public void clear() { buffer.clear(); } public void compact() { buffer.compact(); } - public void flip() { buffer.flip(); } + public void flip() { ((Buffer) buffer).flip(); } public boolean hasRemaining() { return buffer.hasRemaining(); } public int position() { return buffer.position(); } @@ -89,7 +90,7 @@ public class MiniSSL extends RubyObject { public void resize(int newCapacity) { if (newCapacity > buffer.capacity()) { ByteBuffer dstTmp = ByteBuffer.allocate(newCapacity); - buffer.flip(); + flip(); dstTmp.put(buffer); buffer = dstTmp; } else { @@ -101,7 +102,7 @@ public class MiniSSL extends RubyObject { * Drains the buffer to a ByteList, or returns null for an empty buffer */ public ByteList asByteList() { - buffer.flip(); + flip(); if (!buffer.hasRemaining()) { buffer.clear(); return null;