Compiler error not detected


I have a little issue where code does not compile but Idea does not find
an error:

I have the following

class "Foo" in package "A" with a package private method "bar"
class "MyFoo extends Foo" in package "B" (does not override "bar")

class "MainClass" in package "A" calling method "bar"
MyFoo foo = new MyFoo() <-- this line does not compile

I have to upcast foo to


And now Idea is complainig about a redundant cast...

Any comments?

Johannes Schneider

Please sign in to leave a comment.