Covariant overrides on the Buffer Hierarchy redux

Paul Sandoz paul.sandoz at oracle.com
Fri Oct 17 09:37:08 UTC 2014


Hi,

[Including compiler-dev, i am not on that list so please CC me if replying to just that list]

I dropped this, then JVMLS got in the way... then J1 got in the way.... so i better get to this before Devoxx gets in the way... Richard, thanks for your continued patience.

In the interim Richard made a slight tweak to the patch and some tests were updated to avoid casts:

  http://cr.openjdk.java.net/~rwarburton/buffer-overrides-3/

This looks good. Reviewed!

BUT in the interim some warnings were enabled and now javac fails to compile:

/Users/sandoz/Projects/jdk9/dev/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java:245: warning: [cast] redundant cast to CharBuffer
            return (CharBuffer)CharBuffer.allocate(1).flip();
                   ^
/Users/sandoz/Projects/jdk9/dev/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java:329: warning: [cast] redundant cast to ByteBuffer
                    put((ByteBuffer)result.flip());
                        ^
/Users/sandoz/Projects/jdk9/dev/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java:336: warning: [cast] redundant cast to ByteBuffer
        return (ByteBuffer)result.flip();
               ^
/Users/sandoz/Projects/jdk9/dev/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java:352: warning: [cast] redundant cast to ByteBuffer
                ? (ByteBuffer)cached.clear()
                  ^
/Users/sandoz/Projects/jdk9/dev/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java:81: warning: [cast] redundant cast to CharBuffer
            return ((CharBuffer)buffer.compact().flip()).array();
                    ^
error: warnings found and -Werror specified

So Richard has a patch for that too:

  http://cr.openjdk.java.net/~rwarburton/buffer-overrides-langtools-0/langtools.patch

This is required because in the bootstrap compilation phase a JDK without the co-variant overrides can be used. So the current solution is to suppress the warnings. Reviews from langtools gurus are very much appreciated.

Ideally it would be nice to push all this under one issue, is that possible? If not i will have to create another issue and of course push to langtools before jdk.

A internal CCC is also underway.

Paul.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20141017/08236b23/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 841 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20141017/08236b23/signature.asc>


More information about the nio-dev mailing list