-
Bug
-
Resolution: Fixed
-
P2
-
1.1.4
-
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.
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.
- relates to
-
JDK-4032110 Inner classes can't access enclosing instance when inner class is subclass of ou
- Closed