Name: vi73552 Date: 04/29/99
A very long series (~ infinite) of error messages arose when I
attempted to compile (javac) my Java file.
The messages were:
"at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java)
repeated many many times, and finally
"at sun.tools.java.Environment.resolveNames(Environment.java)"
"at sun.tools.javac.SourceClass.resolveTypeStructure(SourceField.java)"
"at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java)"
"at sun.tools.javac.Main.compile(Main.java)"
"at sun.tools.javac.Main.main(Main.java)"
error: An error has occurred in the compiler;
I was attempting to compile a class that extended another class.
I had the wrong line in my file.
Instead of the correct:
public class xx extends yy {
I had the wrong:
public class xx extends xx {
(Note that both class names are the same.)
So this illegal recursion sent the compiler into a loop of errors.
There should be a check for this incorrect self-extension, so bad
typists such as myself don't have problems. Thanks.
---------------------------------------------------------------------
import java.applet.*;
import java.awt.*;
public class Scribble_6_3 extends Scribble_6_3 {
// Read in two color parameters and set the colore.
public void init() {
super.init();
Color foreground = getColorParameter("foreground");
Color background = getColorParameter("background");
if (foreground != null) this.setForeground(foreground);
if (background != null) this.setBackground(background);
}
// Read the specified parameter.
// Interpret it as a hexadecimal number = RRGGBB and convert it to a color.
protected Color getColorParameter(String name) {
String value = this.getParameter(name);
try { return new Color(Integer.parseInt(value, 16) );
}catch (Exception e){
return null;
}
}
// Return information for display in an "About" dialog box.
public String getAppletinfo() {
return "Scribble v. 6.4. written by John Blair.";
}
// Return information about the supported parameters.
// Web browsers and applet viewers should display this, and may also
// allow viewers to set the parameter values.
public String[][] getParameterInfo() { return info; }
// Here is the information that getParameterinfo() returns.
// It is an array of arrays of strings describing each parameter.
// Format: parameter name, parameter type, parameter description
private String[][] info = {
{"foreground", "hexadecimal color value", "foreground color"},
{"background", "hexadecimal color value", "background color"}
};
}
(Review ID: 57596)
======================================================================
- duplicates
-
JDK-4123500 Compiler dies when class attempts to implement itself
-
- Closed
-