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

JCK: System.out.println affects BigDecimal and BigInteger objects

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      linux, windows_98

      Description


      The following test fails on Linux and Windows while executing against HotSpot Server VM in -Xcomp mode.
      ------------ test.java -----------
      import java.math.*;

      public class test {
       public static void main( String[] args ) {
              BigDecimal n = new BigDecimal("1"+Long.MAX_VALUE);
              System.out.println(n);
              BigInteger m = new BigInteger("1"+Long.MAX_VALUE);
              System.out.println(m);
              if (n.toString().equals("1"+Long.MAX_VALUE))
                  System.out.println("First test passed");
              else
                  System.out.println("First test failed");
              if (m.toString().equals("1"+Long.MAX_VALUE))
                  System.out.println("Second test passed");
              else
                  System.out.println("Second test failed");

          }
      }
      ----------------------------------

      Below is output from the test execution:
      -----------------------------------------------------
      %java -server -Xcomp test
      19223372036854775807
      19223372037123211263
      First test failed
      Second test failed
      %java -server test
      19223372036854775807
      19223372036854775807
      First test passed
      Second test passed
      %java -client -Xcomp test
      19223372036854775807
      19223372036854775807
      First test passed
      Second test passed
      %java -client test
      19223372036854775807
      19223372036854775807
      First test passed
      Second test passed
      %
      -----------------------------------------------------

      The JDK version is:
      java version "1.3.1beta"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1beta-b08)
      Java HotSpot(TM) Server VM (build 1.3.1beta-b08, compiled mode)

      The test passes in -Xmixed and in -Xint modes against JDK 1.3.1 Server VM; as well as the test passes in all execution modes against the Client VM.
      The test passes against JDK 1.3.1-b07 both Client and Server VMs in all execution modes.

      The following JCK1.3 api tests fail due to this bug against JDK1.3.1beta-b08 HS Server VM in -Xcomp mode:
      api/java_math/BigDecimal/index.html#ValueOf
      api/java_math/BigDecimal/index.html#ToString
      api/java_math/BigDecimal/index.html#Ctor
      api/java_math/BigInteger/index.html#Unary
      api/java_math/BigInteger/index.html#Ctor

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              rasbold Chuck Rasbold
              Reporter:
              irasunw Ira Ira (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: