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

NoSuchMethodError in BigDecimal when compiling with 1.5 targetted for 1.4

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 5.0
    • tools
    • x86
    • linux

    Description

      FULL PRODUCT VERSION :
      Both :
      java version "1.4.2_07"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_07-b05)
      Java HotSpot(TM) Client VM (build 1.4.2_07-b05, mixed mode)
      And
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode)



      ADDITIONAL OS VERSION INFORMATION :
      Linux dub-280-41 2.6.10-gentoo-r4 #1 SMP Mon Jan 10 12:03:01 GMT 2005 i686 Intel(R) Pentium(R) 4 CPU 3.00GHz GenuineIntel GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      I was looking into migrating from JDK1.4 to JDK1.5, and given the code (in the example code section)

      when I compile this on JDK1.4, it compiles and runs correctly
      However, when I compile it as:
      /opt/sun-jdk-1.5.0.01/bin/javac -source 1.4 Test.java
      And run it (using the 1.4 JVM), I get the following error at runtime:
      Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the example source using JDK1.4, run -- works correctly
      Compile the example source using JDK1.5, and run against the 1.5 JVM -- works correctly
      Compile the example source using JDK1.5, and run against the 1.4 JVM -- fails with NoSuchMethodError

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Should work on all releases.
      ACTUAL -
      NoSuchMethodError

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.NoSuchMethodError: java.math.BigDecimal.<init>(I)V
              at Test.main(Test.java:6)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.math.BigDecimal;

      public class Test
      {
              public static void main(String[] args)
              {
                      BigDecimal dec = new BigDecimal(1);
              }
      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Change the code to
                      BigDecimal dec = new BigDecimal((double) 1);
      ###@###.### 2005-2-08 21:09:42 GMT

      Attachments

        Issue Links

          Activity

            People

              darcy Joe Darcy
              gmanwanisunw Girish Manwani (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: