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

Block-local classes are not found in nested scopes

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 1.1.1, 1.2.0
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • CPU:
      generic, sparc
    • OS:
      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

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: