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

(scope) static final variable declared after use and self initialized

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 1.4.1
    • Fix Version/s: 6
    • Component/s: tools
    • Subcomponent:
    • Resolved In Build:
      b57
    • CPU:
      x86
    • OS:
      windows_xp
    • Verification:
      Verified

      Description

      Name: tb29552 Date: 04/15/2003


      public class FinalStaticBug {
          public static void main(String[] p_args)
          {
              System.out.println("Order By: " + ORDER_BY_DATE_TIME);
          }

          private static final String ORDER_BY_DATE_TIME = ORDER_BY_DATE_TIME;
      }


      Compiles OK using javac from 1.3.1 and 1.4.x, reporting 'null'
      at runtime:

      % javac -g -J-showversion FinalStaticBug.java
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      % java FinalStaticBug
      Order By: null

      The oldjavac compiler in 1.3.1 reports an error at compile time:

      % oldjavac -g -J-showversion FinalStaticBug.java
      java version "1.3.1"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.1-b24)
      Java HotSpot(TM) Client VM (build 1.3.1-b24, mixed mode)

      FinalStaticBug.java:7: Can't make forward reference to ORDER_BY_DATE_TIME in class FinalStaticBug.
          private static final String ORDER_BY_DATE_TIME = ORDER_BY_DATE_TIME;
                                                           ^
      1 error



      (Review ID: 184134)
      ======================================================================
      ###@###.### 10/25/04 21:26 GMT

        Attachments

          Activity

            People

            • Assignee:
              ahe Peter Ahe
              Reporter:
              tbell Tim Bell
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: