RFR: 8238213: Method resolution should stop on static error

Vicente Romero vromero at openjdk.java.net
Fri Jun 4 03:05:10 UTC 2021


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

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

Commit messages:
 - 8238213: Method resolution should stop on static error

Changes: https://git.openjdk.java.net/jdk/pull/4351/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=4351&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8238213
  Stats: 23 lines in 3 files changed: 22 ins; 0 del; 1 mod
  Patch: https://git.openjdk.java.net/jdk/pull/4351.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/4351/head:pull/4351

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


More information about the compiler-dev mailing list