mirror of
https://github.com/openjdk/jdk.git
synced 2026-05-10 05:29:48 +00:00
8062376: Suppress cast warnings when using NIO buffers
Reviewed-by: psandoz, jfranck
This commit is contained in:
parent
08336b39dd
commit
b587478f7c
@ -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();
|
||||
|
||||
@ -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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user