public class Loader implements LoadParam, SortParam {
public interface LoadParam {
public static final LoadType FROM_MEMORY = new LoadType(1);
public static final LoadType FROM_FLATFILE = new LoadType(2);
public static final LoadType FROM_DB = new LoadType(4);
final class LoadType {
private final int m_loadtype;
private LoadType(int aType) {
m_loadtype = aType;
}
}
}
public interface SortParam {
public static final SortType BY_CITY = new SortType(1);
public static final SortType BY_NAME = new SortType(2);
public static final SortType BY_NUMBER = new SortType(4);
final class SortType {
private final int m_sorttype;
private SortType(int aType) {
m_sorttype = aType;
}
}
}
/** Creates new Loader */
public Loader() {
}
}
However, when I compile it, I get this error:
TestParameterConstants/SiteLoader.java [17:12] cyclic inheritance
involving TestParameterConstants.SiteLoader
public interface LoadParameters {
TestParameterConstants/SiteLoader.java [29:12] cyclic inheritance
involving TestParameterConstants.SiteLoader
public interface SortParameters {
2 errors
Does anyone have ideas about why? I'm using Java SDK 1.3 with Forte.
Mark McDowell
D:\java>javac *.java
sun.tools.java.CompilerError: illegal class modifiers
at
sun.tools.javac.SourceClass.assertModifiers(SourceClass.java:2059)
at sun.tools.javac.SourceClass.compileClass(SourceClass.java:2577)
at sun.tools.javac.SourceClass.compile(SourceClass.java:2039)
at sun.tools.javac.Main.compile(Main.java:567)
at sun.tools.javac.Main.main(Main.java:733)
error: An error has occurred in the compiler; please file a bug report
(http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
"Mark McDowell" <m.mcd...@bigfoot.com> wrote in message
news:MPG.140603cee...@news.ic.ncs.com...
On JDK 1.2 it does compile after you fix the error in the first line,
public class Loader implements Loader.LoadParam, Loader.SortParam {
So maybe Sun has a new policy on the subject. I'm going to check the
what's new for 1.3 docs.
> On JDK 1.2 it does compile after you fix the error in the first line,
> public class Loader implements Loader.LoadParam, Loader.SortParam {
> So maybe Sun has a new policy on the subject. I'm going to check the
> what's new for 1.3 docs.
Sure enough ! This behavior has been submitted as bug
http://developer.java.sun.com/developer/bugParade/bugs/4326631.html
But they insist it is not a bug, and refer you to the JLS 2nd Ed., saying
that:
"...the rule against cyclic inheritance has been extended to prohibit
a class or interface from "depending" on itself, directly or
indirectly........."
Mark
Sigh... :)
Mark