8062376: Suppress cast warnings when using NIO buffers
authorrwarburton
Wed, 29 Oct 2014 12:09:17 +0100
changeset 27318 4660a5da7d90
parent 27317 a497a919b562
child 27319 030080f03e4f
8062376: Suppress cast warnings when using NIO buffers Reviewed-by: psandoz, jfranck
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Thu Sep 25 14:38:29 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java	Wed Oct 29 12:09:17 2014 +0100
@@ -76,6 +76,7 @@
  */
 public class JavacFileManager extends BaseFileManager implements StandardJavaFileManager {
 
+    @SuppressWarnings("cast")
     public static char[] toArray(CharBuffer buffer) {
         if (buffer.hasArray())
             return ((CharBuffer)buffer.compact().flip()).array();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Thu Sep 25 14:38:29 2014 -0700
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java	Wed Oct 29 12:09:17 2014 +0100
@@ -235,6 +235,7 @@
             return encName;
     }
 
+    @SuppressWarnings("cast")
     public CharBuffer decode(ByteBuffer inbuf, boolean ignoreEncodingErrors) {
         String encodingName = getEncodingName();
         CharsetDecoder decoder;
@@ -315,6 +316,7 @@
      * @return a byte buffer containing the contents of the stream
      * @throws IOException if an error occurred while reading the stream
      */
+    @SuppressWarnings("cast")
     public ByteBuffer makeByteBuffer(InputStream in)
         throws IOException {
         int limit = in.available();
@@ -343,6 +345,7 @@
     /**
      * A single-element cache of direct byte buffers.
      */
+    @SuppressWarnings("cast")
     private static class ByteBufferCache {
         private ByteBuffer cached;
         ByteBuffer get(int capacity) {