RFR: 8238213: Method resolution should stop on static error

Jan Lahoda jlahoda at openjdk.java.net
Wed Jun 9 15:56:13 UTC 2021


On Fri, 4 Jun 2021 02:58:15 GMT, Vicente Romero <vromero at openjdk.org> wrote:

> Please review this fix that is stopping method resolution if a static error is found. Currently javac rejecting code like:
> 
> public class Test {
>     public static void main(String[] args) {
>         test(5.0);
>     }
>   
>     void test(double d) {}
>     void test(Double d) {}
> }
> 
> but for the wrong reason. Basically it is that the invocation of method `test` is ambiguous as if both were applicable when it should fail at the end of the first overload resolution phase indicating that the non-static method test(double) can't be referred from a static context. This patch is fixing this issue.
> 
> TIA

LGTM

-------------

Marked as reviewed by jlahoda (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/4351


More information about the compiler-dev mailing list