Integrated: 8238213: Method resolution should stop on static error

Vicente Romero vromero at openjdk.java.net
Wed Jun 9 15:59:21 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

This pull request has now been integrated.

Changeset: bb3d226a
Author:    Vicente Romero <vromero at openjdk.org>
URL:       https://git.openjdk.java.net/jdk/commit/bb3d226a4eedb3d3ef73ef91683f45f1db43a74e
Stats:     23 lines in 3 files changed: 22 ins; 0 del; 1 mod

8238213: Method resolution should stop on static error

Reviewed-by: jlahoda

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

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


More information about the compiler-dev mailing list