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

Can't compile subclasses of inner classes

    Details

    • Subcomponent:
    • Introduced In Build:
      beta
    • Introduced In Version:
    • Resolved In Build:
      b73
    • CPU:
      generic, x86
    • OS:
      solaris_8, windows_xp
    • Verification:
      Verified

      Backports

        Description

        Name: rmT116609 Date: 08/07/2003


        FULL PRODUCT VERSION :
        java version "1.4.2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2-b28)
        Java HotSpot(TM) Client VM (build 1.4.2-b28, mixed mode)

        FULL OS VERSION :
        Microsoft Windows XP version 5.1.2600

        A DESCRIPTION OF THE PROBLEM :
        J2SE 1.4.2's javac will not compile classes that have doubly-nested inner subclasses, such as the following test case:

        class InnerClassBugTestCase
        {
            private class InnerSuperclass extends InnerClassBugTestCase
            {
            }

            private class InnerSubclass extends InnerSuperclass
            {
            }
        }

        The error message provided is:

        InnerClassBugTestCase.java:7: cannot reference this before supertype constructor has been called
            private class InnerSubclass extends InnerSuperclass

        J2SE 1.4.2-beta and J2SE 1.4.1_03's version of javac compiles the class without errors or warnings.

        REGRESSION. Last worked in version mantis-beta

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Create a text containing the following Java code:

        class InnerClassBugTestCase
        {
            private class InnerSuperclass extends InnerClassBugTestCase
            {
            }

            private class InnerSubclass extends InnerSuperclass
            {
            }
        }

        Save the file as InnerClassBugTestCase.java.

        Attempt to compile InnerClassBugTestCase.java using J2SE 1.4.2's javac compiler: javac InnerClassBugTestCase.java

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        javac would compile the class into InnerClassBugTestCase.class.
        ACTUAL -
        javac did not compile the class, providing an error message that does not seem to apply.



        ERROR MESSAGES/STACK TRACES THAT OCCUR :
        InnerClassBugTestCase.java:7: cannot reference this before supertype constructor has been called
            private class InnerSubclass extends InnerSuperclass

        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        class InnerClassBugTestCase
        {
            private class InnerSuperclass extends InnerClassBugTestCase
            {
            }

            private class InnerSubclass extends InnerSuperclass
            {
            }
        }
        ---------- END SOURCE ----------

        Release Regression From : mantis-beta
        The above release value was the last known release where this
        bug was known to work. Since then there has been a regression.

        (Incident Review ID: 189935)
        ======================================================================
        ###@###.### 10/25/04 21:44 GMT

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  ahe Peter Ahe
                  Reporter:
                  rmandalasunw Ranjith Mandala (Inactive)
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: