Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8066751

Remove casts redundant with Java 9 buffer APIs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b64
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        compile:
            [javac] Compiling 502 source files to /Users/marcus/src/jdk9/nashorn/build/classes
            [javac] warning: [options] bootstrap class path not set in conjunction with -source 1.8
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java:228: warning: [cast] redundant cast to ByteBuffer
            [javac] return (ByteBuffer)nb.duplicate().position(offset);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeArrayBuffer.java:232: warning: [cast] redundant cast to ByteBuffer
            [javac] return (ByteBuffer)getBuffer(offset).limit(length);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat32Array.java:84: warning: [cast] redundant cast to FloatBuffer
            [javac] super(((FloatBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFloat64Array.java:84: warning: [cast] redundant cast to DoubleBuffer
            [javac] super(((DoubleBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt16Array.java:85: warning: [cast] redundant cast to ShortBuffer
            [javac] super(((ShortBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt32Array.java:84: warning: [cast] redundant cast to IntBuffer
            [javac] super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeInt8Array.java:83: warning: [cast] redundant cast to ByteBuffer
            [javac] super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint16Array.java:84: warning: [cast] redundant cast to CharBuffer
            [javac] super(((CharBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint32Array.java:85: warning: [cast] redundant cast to IntBuffer
            [javac] super(((IntBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8Array.java:84: warning: [cast] redundant cast to ByteBuffer
            [javac] super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] /Users/marcus/src/jdk9/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeUint8ClampedArray.java:88: warning: [cast] redundant cast to ByteBuffer
            [javac] super(((ByteBuffer)nb.position(start).limit(end)).slice(), end - start);
            [javac] ^
            [javac] 12 warnings
            [javac] Creating empty /Users/marcus/src/jdk9/nashorn/build/classes/jdk/nashorn/internal/objects/package-info.class
            [javac] Creating empty /Users/marcus/src/jdk9/nashorn/build/classes/jdk/nashorn/api/scripting/package-info.class
             [copy] Copying 1 file to /Users/marcus/src/jdk9/nashorn/build/classes/META-INF/services
             [copy] Copying 1 file to /Users/marcus/src/jdk9/nashorn/build/classes/jdk/nashorn/api/scripting/resources
             [copy] Copying 14 files to /Users/marcus/src/jdk9/nashorn/build/classes/jdk/nashorn/internal/runtime/resources
             [copy] Copying 2 files to /Users/marcus/src/jdk9/nashorn/build/classes/jdk/nashorn/tools/resources
             [copy] Copying 1 file to /Users/marcus/src/jdk9/nashorn/build/classes/jdk/internal/dynalink/support
             [copy] Copying 1 fil


        This is correct- the casts shouldn't need to be there.
        The problem is that if I remove them, I break backwards compatibility towards earlier 9 builds than b38, and compatibility with 8.

        I can easily remove these redundant casts and push to 9, but I need to know if breaking backwards compatibility to builds < b38 is acceptable. This would make it hard for us to, e.g., build and regression test against earlier builds.

        Advice needed.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                attila Attila Szegedi
                Reporter:
                lagergren Marcus Lagergren
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: