Hello!
Here is a bug, that all versions of SUN java 1-5-0 compilers seem to have.
The bug is, that a class, extending a base class, cannot be compiled
(because of a (wrong) error message), except you compile
both base class and sub class together.
Try this:
Write to classes, store them in appropriate files:
--------------------Base.java--------------------
public class Base {
protected class Inner <T> {
}
protected Inner<String> constructInnerOfString (String s) {
return new Inner<String>();
}
}
--------------------/Base.java--------------------
--------------------Sub.java--------------------
public class Sub extends Base {
private Inner<String> innerStr = constructInnerOfString("");
}
--------------------/Sub.java--------------------
Now compile:
javac -classpath . Base.java Sub.java
It works.
Now compile only the sub class:
javac -classpath . Sub.java
Ooops, you will get this (wrong) compiler error message:
Sub.java:4: incompatible types
found : Base.Inner<java.lang.String>
required: Base.Inner<java.lang.String>
private Inner<String> innerStr = constructInnerOfString("");
^
1 error
The problem seem to occur every time, you assign it to a variable.
If you assign the variable 'innerStr' in a constructor, you will get it,
too.
If you just call the method constructInnerOfString(...), you will get it
not.
Is this compiler bug known?
Or is it a new one?
Does anybody know anything about it?
Greetings
Reinhard Bellmann
Thomas Hawtin - 23 Dec 2005 10:57 GMT
> Is this compiler bug known?
> Or is it a new one?
> Does anybody know anything about it?
Have you searched bugs.sun.com?
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/
Reinhard B. - 23 Dec 2005 21:43 GMT
Hello!
Thomas Hawtin schrieb:
> Have you searched bugs.sun.com?
Now I did. :-)
It seems to be this one:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6343995
Thanx!
Reinhard

Signature
Reinhard Bellmann
hiwa - 24 Dec 2005 00:33 GMT
JDK 1.6 (build 61) does not have this bug.
Thomas Hawtin - 24 Dec 2005 09:00 GMT
> JDK 1.6 (build 61) does not have this bug.
Really? 1.6.0-rc-b63 does.
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/