Loading... (original) (raw)
lint: javac should warn when an instance method and a static method with the same name leads to ambiguous method reference
- Type:
Enhancement
- Resolution: Unresolved
- Priority:
P4
- Fix Version/s: tbd
- Affects Version/s: 8, 9
An instance method and a static method that take the current class as first parameter can be ambiguous when trying to create a method reference.
Here is an example given by Brian on the core-dev mailing list:
class Foo {
void m(int x)
static void m(Foo f, int x)
}
here, Foo::m is ambiguous.
see http://mail.openjdk.java.net/pipermail/core-libs-dev/2015-May/033415.html
javac should emit a warning in this case to help API designer to avoid such issue.