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

compiler denies to declare inner class within an anonymous inner class

    XMLWordPrintable

Details

    • 1.2beta
    • x86, sparc
    • solaris_2.5.1, windows_95
    • Verified

    Description



      Name: laC46010 Date: 07/09/97



      Java compiler fails to compile a code, where an inner class is
      declared within an anonymous inner class. In example "Test.java"
      below, all JDK compilers from 1.1 thru 1.1.3 report the following
      compile-time error:

      Test.java:2: Superclass of local class Test. 1 not found.
      Object o = new Object() {
      ^
      1 error

      Note, that it is essential for this error that inner class
      (or interface) 'A' is declared withing anonymous class extending
      class 'Object'.

      --------------------Test.java----------------------
      class Test {
      Object o = new Object() {
      class A {}
      };
      }
      --------------------------------------------------------------------------------

      ======================================================================

      Attachments

        Activity

          People

            wmaddoxsunw William Maddox (Inactive)
            leosunw Leo Leo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: