You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2018/12/19 22:47:37 UTC

[GitHub] olamy closed pull request #4: [MSHARED-786] jdk8 incompatibility at runtime (NoSuchMethodError)

olamy closed pull request #4: [MSHARED-786] jdk8 incompatibility at runtime (NoSuchMethodError)
URL: https://github.com/apache/maven-dependency-analyzer/pull/4
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/ConstantPoolParser.java b/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/ConstantPoolParser.java
index 333d0f9..c0e0cac 100644
--- a/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/ConstantPoolParser.java
+++ b/src/main/java/org/apache/maven/shared/dependency/analyzer/asm/ConstantPoolParser.java
@@ -19,6 +19,7 @@
  * under the License.
  */
 
+import java.nio.Buffer;
 import java.nio.ByteBuffer;
 import java.nio.ByteOrder;
 import java.util.Collections;
@@ -159,8 +160,10 @@
 
     private static String decodeString( ByteBuffer buf )
     {
-        int size = buf.getChar(), oldLimit = buf.limit();
-        buf.limit( buf.position() + size );
+        int size = buf.getChar();
+        // Explicit cast for compatibility with covariant return type on JDK 9's ByteBuffer
+        int oldLimit = ( (Buffer) buf ).limit();
+        ( (Buffer) buf ).limit( buf.position() + size );
         StringBuilder sb = new StringBuilder( size + ( size >> 1 ) + 16 );
         while ( buf.hasRemaining() )
         {
@@ -183,7 +186,7 @@ private static String decodeString( ByteBuffer buf )
                 }
             }
         }
-        buf.limit( oldLimit );
+        ( (Buffer) buf ).limit( oldLimit );
         return sb.toString();
     }
 }


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services