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

enclosing class instance method call chokes inner class compile

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 1.1.5
    • 1.1.4
    • tools
    • 1.1.5
    • generic
    • solaris_2.6
    • Not verified

      /* the following code does not compile, depending on
      the presence of the annonymous class definition
      with the call to the enclosing class instance method,
      and the position of the call to inherited instance method
      Container.add(Component): */

      import java.awt.event.*;
      import java.awt.*;
      import java.applet.*;

      public class Test extends Applet {

          public void fred() {
         MenuItem im = new MenuItem( "foo" );

      //add( new PopupMenu() ); /* position 1 */

        im.addActionListener( new ActionListener() {
        public void actionPerformed( ActionEvent e ) {
      Test.this.foo();
        }
        });

      /* compiler error with the below instance method call
      at position 2. At position 1 the call does not
      generate the error */

      add( new PopupMenu() ); /* position 2 */

          }

      /* call to enclosing class instance method Test.foo must be present
      to generate error */
          private void foo() {
      ;
          }
      }

      /* compiler error on Solaris 5.6 reads:
      Can't reference this before the superclass constructor has been called.
              add( new PopupMenu() );

      brian.preston@eng 1997-10-16
      */


      allan.jacobs@Eng 1997-11-24
      Shadow bug 4094992.

            dstoutamsunw David Stoutamire (Inactive)
            bprestonsunw Brian Preston (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: