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

enclosing class instance method call chokes inner class compile

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 1.1.4
    • Fix Version/s: 1.1.5
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      1.1.5
    • CPU:
      generic
    • OS:
      solaris_2.6
    • Verification:
      Not verified

      Description

      /* 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.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: