A block scoped class isn't seen by a reference from a nested block

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P2
    • 1.2.0
    • Affects Version/s: 1.1, 1.1.1, 1.1.4
    • Component/s: tools
    • 1.2beta
    • generic, sparc
    • generic, solaris_2.5.1
    • Not verified


      /* A block scoped class isn't seen by a reference from a
       * nested block. The example below doesn't compile unless
       * the braces marked "XXX" are removed.

      mushmouth% javac BlockScopedClassBug1.java
      BlockScopedClassBug1.java:9: Class bar not found in type declaration.
            return new bar().getX();
                       ^
      1 error

       */

      public class BlockScopedClassBug1
      {
        protected int foo(final int x)
        {
          final class bar { int getX() {return x;} }

          { // XXX
            return new bar().getX();
          } // XXX
        }
      }

            Assignee:
            William Maddox (Inactive)
            Reporter:
            Swingtraq Swingtraq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: