Possible compiler bug
Stefan Reich
stefan.reich.maker.of.eye at googlemail.com
Tue Oct 22 11:11:22 UTC 2019
Hi, ok, the class relationships in this example are bit convoluted (I have
them for a reason in the original source code), but I still don't see why
it would fail to compile.
import java.util.Map;
class Referenced {
}
class Base<A extends Base.Inner> {
class Inner {
Map<Integer, Referenced> map;
void bla() {
Referenced r = map.get(0);
}
}
}
class Derived extends Base<Derived.Inner> {
class Inner extends Base.Inner {
void bla() {
Referenced r = map.get(0);
}
}
}
The error message is:
Referenced.java:20: error: incompatible types: Object cannot be converted
to Referenced
Referenced r = map.get(0);
Why does the map suddenly lose its type parameters?
Many greetings,
Stefan
--
Stefan Reich
BotCompany.de // Java-based operating systems
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20191022/d66bf3f2/attachment.html>
More information about the compiler-dev
mailing list