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

Block-local classes are not found in nested scopes

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P3
    • None
    • 1.1.1, 1.2.0
    • tools
    • None
    • generic, sparc
    • solaris_2.5.1

    Description

      Why is the following program illegal?
       
      icho@villa127: cat T1.java
      public class T1 {
       T1() {
        class T2 {
         T2() {
          class T3 {};
          T3 t = new T3();
         }
        }
       }
      }
       
      icho@villa126: javac T1.java
      T1.java:6: Class T1. 1$T3 not found in type declaration.
          T3 t = new T3();
          ^
      T1.java:6: Class T1. 1$T3 not found in type declaration.
          T3 t = new T3();
                     ^
      2 errors
      ------------------------
      While the following program compiles;
       
      public class T1 {
       T1() {
        class T2 {
         class T3 {};
         T2() {
          T3 t = new T3();
         }
        }
       }
      }

      Attachments

        Issue Links

          Activity

            People

              wmaddoxsunw William Maddox (Inactive)
              dstoutamsunw David Stoutamire (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: