Loading... (original) (raw)

Uploaded image for project: 'JDK'

  1. JDK
  2. JDK-8080413

lint: javac should warn when an instance method and a static method with the same name leads to ambiguous method reference

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.