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

Compiler error abount final variable without any sense.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 6u22
    • tools
    • x86
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.6.0_20"

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]
      Linux 2.6.32-25-generic Ubuntu x86_64 GNU/Linux


      A DESCRIPTION OF THE PROBLEM :
      I habe written a source code, that complains abount a final variable, that might already have been assigned.
      If I change something (delete a line or change the order) it compiles.

      I cutted the code to this small version, to improve readability.


      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Just compile

      ACTUAL -
      Compiler-Error:


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      "variable x might already have been assigned"


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Test {

      private final Object x;

          private Test() {
              {
                  int inx = 0;
                  for(int i = 0; i < 5; i++) {
                  }
              }
              for(String am: new String[1]) {
                  final String mode = am;
              }
              x = null;
          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Change anything.

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: