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

javac: incorrect compilation a class contains an inner classes

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_7

      Description

      During compile the following simple test javac prints the error message:

      class X {
         String s=null;
        
         X() {
            s="CLASS_X";
         }

         String test() {
            class Y {
               Y() {
                  s="CLASS_Y";
               }
           
               String test() {
                  class Z extends X {
                     Z() {
                        X.new Y().super(); //Y's constructor is expected to be called.
                     }
                     String test() {
                        return s;
                     }
                  }
                  return new Z().test();
               }
            }
            return new Y().test();
         }
         
         public static void main(String[] s) {
            X x=new X();
            System.out.println(x.s); // String "CLASS_X" should appear.
         }
      }

      <cos@ultracos: (screen:1).1063> javac -server test.java
      test.java:17: illegal qualifier; X is not an inner class
                        X.new Y().super(); //Y's constructor is expected to be called.
                          ^
      1 error

      This test has been succesfully compiled by both of Classic and Solaris refs v. 1.2.2.

      konstantin.boudnik@eng 2000-02-22

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              wmaddoxsunw William Maddox (Inactive)
              Reporter:
              kboudniksunw Konstantin Boudnik (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: