From the Eclipse Java compiler setting: Method does not override package visible method
"A package default method is not visible in a different package, and thus cannot be overridden. When this option is enabled, the compiler will signal such scenario either as an error or a warning."
How can I trigger this Warning/Error? I'm looking for a code example.
package foopackage;
public class Foo {
String getString() {
return "foo";
}
}
package barpackage;
import foopackage.Foo;
public class Bar extends Foo {
String getString() {
return "bar";
}
}
Should do it.
From the Eclipse Help docs:
A package default method is not visible in a different package, and thus cannot be overridden. When this option is enabled, the compiler will signal such scenario either as an error or a warning.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With