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

java.nio.XxxBuffer classes lack constructors

    XMLWordPrintable

Details

    • Enhancement
    • Resolution: Duplicate
    • P5
    • None
    • 1.4.1
    • core-libs
    • x86
    • windows_2000

    Description



      Name: nt126004 Date: 02/21/2003


      FULL PRODUCT VERSION :
      not version-related

      FULL OPERATING SYSTEM VERSION : not OS-related


      A DESCRIPTION OF THE PROBLEM :
      java.nio.XxxBuffer classes have hidden constructors, but not
      java-style constructors. The constructor(s) for a java class
      should not be hidden in static methods.

      This report is basically a comment on closed bug 4712383.

      There are no constructors and there are no getters and setters. Hide() and show() were
      deprecated at JDK 1.1 in favor of isVisible() and setVisible(). Java.nio is 1.4 code that
      should have been deprecated three versions before it was released.

      What we have here is code that was very obviously written by a Java newcomer who needed a more
      experienced hand looking over his/her work. I call it a bug in the software management process.

      I'm giving zero credence to the "it's for efficiency" argument. See my report 181086 - what
      should be an optimized operation turns out to be five times slower than System.arraycopy().

      System.arraycopy() is a good example of efficiency. It's done at the method level, not the
      class level. No attempt is made to prevent me from overriding that method wth my own code, even
      though the result would certainly be slower.

      What we need here are some well-coded, java-consistent classes. What we've got doesn't make the
      grade. It's just not up to your usual standards.

      I should add that .nio with all its faults is still a lot better than not having this
      capability at all. I'm getting good results with a RandomAccessFile feeding a ByteBuffer
      wrapped with an IntBuffer.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1.see the java.nio.XxxBuffer docs
      2.
      3.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      XxxBuffer xb = new XxxBuffer( new Xxx[size] );
         // java-style constructor - not provided

      XxxBuffer xb = XxxBuffer.wrap( new Xxx[size] );
         // this works, but it's not java


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER WORKAROUND :
      write as per the docs
      (Review ID: 181073)
      ======================================================================

      Attachments

        Issue Links

          Activity

            People

              iris Iris Clark
              nthompsosunw Nathanael Thompson (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: