8062376: Suppress cast warnings when using NIO buffers

Reviewed-by: psandoz, jfranck
This commit is contained in:
Richard Warburton 2014-10-29 12:09:17 +01:00
parent 08336b39dd
commit b587478f7c
2 changed files with 4 additions and 0 deletions

View File

@ -76,6 +76,7 @@ import static javax.tools.StandardLocation.*;
*/
public class JavacFileManager extends BaseFileManager implements StandardJavaFileManager {
@SuppressWarnings("cast")
public static char[] toArray(CharBuffer buffer) {
if (buffer.hasArray())
return ((CharBuffer)buffer.compact().flip()).array();

View File

@ -235,6 +235,7 @@ public abstract class BaseFileManager implements JavaFileManager {
return encName;
}
@SuppressWarnings("cast")
public CharBuffer decode(ByteBuffer inbuf, boolean ignoreEncodingErrors) {
String encodingName = getEncodingName();
CharsetDecoder decoder;
@ -315,6 +316,7 @@ public abstract class BaseFileManager implements JavaFileManager {
* @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 @@ public abstract class BaseFileManager implements JavaFileManager {
/**
* A single-element cache of direct byte buffers.
*/
@SuppressWarnings("cast")
private static class ByteBufferCache {
private ByteBuffer cached;
ByteBuffer get(int capacity) {