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

Compiler failed to lookup nested class in InnerClass

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.1
    • tools
    • sparc
    • solaris_2.5.1

      It is a compiler bug rejecting a correct program.
      Block-local classes are not getting looked up properly
      from within deeply nested scopes.


      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();
         }
        }
       }
      }

            dstoutamsunw David Stoutamire (Inactive)
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: