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

Compiler error abount final variable without any sense.

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Cannot Reproduce
    • Affects Version/s: 6u22
    • Fix Version/s: None
    • Component/s: tools
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_7

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: