Compile errors with super.

Rutger Ovidius ovid@mailandnews.com
Sun Nov 30 17:57:00 GMT 2003


Hi, I'm having trouble understanding a few compile errors. I guess I can best explain
it with an example:
public class One {
 public Object A() {
 return new Object();
 }
}
public class Two extends One {
 public void B () {
 Object obj = Two.super.A();
 }
 public static void main(String[] args)
 {}
}
gcj -c *.java
Two.java:5: error: 'class' or 'this' expected.
 Object obj = Two.super.A ()
javac *.java works fine.
If I make "A" return void:
---
One: public A() {}
Two: public void B {} { Two.super.A(); }
---
I get:
gcj -c *.java
Two.java:5: error: '(' expected.
 Two.super.A ();
The original code I am trying to compile from .java is from jface
(eclipse):
 protected Control createContents(final Composite parent) {
 final Control[] control = new Control[1];
 BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
 public void run() {
 control[0] = PreferenceDialog.super.createContents(parent);
 // Add the first page
 selectSavedItem();
 }
 });
 return control[0];
 }
This returns a:
org\eclipse\jface\preference\PreferenceDialog.java:294: error: 'class' or 'this' expected.
 control[0] = PreferenceDialog.super.createContents(parent);
gcc version 3.4 20031123 (experimental) (thisiscool win32 build)
Any pointers?


More information about the Java mailing list

AltStyle によって変換されたページ (->オリジナル) /