Harmony
  1. Harmony
  2. HARMONY-180

[classlib][luni] Java 5 enhancements for java.lang.Byte

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Classlib
    • Labels:
      None
    • Estimated Complexity:
      Moderate

      Description

      Enhancements for java.lang.Byte, test cases, javadoc and a little cleanup.

      1. ByteTest.java
        4 kB
        Nathan Beyer
      2. Byte_java_5_patch.txt
        3 kB
        Nathan Beyer

        Activity

        Hide
        Nathan Beyer added a comment -

        'Byte_java_5_patch.txt' is a patch for java.lang.Byte to implement Java 5 enhancements. The most notable is the 'valueOf(byte)', which I've implemented with a simple array-based cache. I've also updated the other methods that used the 'Byte(byte)' constructor to use this method instead. I believe these new 'valueOf' methods in the primitive wrappers are intended to be utilized by the VM (compiler?) for auto-boxing, hence the caching to help resource consumption.

        The 'BytesTest.java' is an initial swipe at the test case. Currently it only tests the new method. I'll try to flush it out more completely later.

        Show
        Nathan Beyer added a comment - 'Byte_java_5_patch.txt' is a patch for java.lang.Byte to implement Java 5 enhancements. The most notable is the 'valueOf(byte)', which I've implemented with a simple array-based cache. I've also updated the other methods that used the 'Byte(byte)' constructor to use this method instead. I believe these new 'valueOf' methods in the primitive wrappers are intended to be utilized by the VM (compiler?) for auto-boxing, hence the caching to help resource consumption. The 'BytesTest.java' is an initial swipe at the test case. Currently it only tests the new method. I'll try to flush it out more completely later.
        Hide
        Tim Ellison added a comment -

        Thanks Nathan,

        Applied patch to LUNI module java.lang.Byte at repo revision 384228.

        I removed the test stubs, just so the report doesn't show that they are tested before there are some tests in place. Based on your comments I also added an assertion to check the valueOf returns the same object (from the cache).

        Please check that the patch was applied as you expected.

        Show
        Tim Ellison added a comment - Thanks Nathan, Applied patch to LUNI module java.lang.Byte at repo revision 384228. I removed the test stubs, just so the report doesn't show that they are tested before there are some tests in place. Based on your comments I also added an assertion to check the valueOf returns the same object (from the cache). Please check that the patch was applied as you expected.
        Hide
        Nathan Beyer added a comment -

        Looks good. I'll try to work on flushing the test case out.

        Show
        Nathan Beyer added a comment - Looks good. I'll try to work on flushing the test case out.
        Hide
        Tim Ellison added a comment -

        Verified by Nathan

        Show
        Tim Ellison added a comment - Verified by Nathan

          People

          • Assignee:
            Tim Ellison
            Reporter:
            Nathan Beyer
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development