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

5.1.7: JLS does not mention caching of autoboxed longs

    XMLWordPrintable

Details

    • x86
    • linux

    Description

      FULL PRODUCT VERSION :


      A DESCRIPTION OF THE PROBLEM :
      http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.1.7

      If the value p being boxed is true, false, a byte, or a char in the range \u0000 to \u007f, or an int or short number between -128 and 127 (inclusive), then let r1 and r2 be the results of any two boxing conversions of p. It is always the case that r1 == r2.

      But long is cached the same as int and short, but this is not mentioned. Is it an oversight or is it deliberately unspecified.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should state that long is cached or state that long may or may not be cache.
      ACTUAL -
      long, float and double are not specified.

      long is cached, float and double are not, so you cannot assume anything from their absence.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      CUSTOMER SUBMITTED WORKAROUND :
      Read the code for OpenJDK instead of the JLS. :(

      SUPPORT :
      YES

      Attachments

        Issue Links

          Activity

            People

              abuckley Alex Buckley
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: