JDK-8238213: javac emits wrong error when calling an non-static overloaded method from static
B. Blaser
bsrbnd at gmail.com
Thu Oct 8 09:44:32 UTC 2020
Testing a few more, I note that a discrepancy with the JLS in this
area might have deeper consequences beyond wrong diagnostics,
consider:
public class Test {
public static void main(String[] args) {
test((Double)5.0);
}
void test(Number n) {
System.out.println(Number.class);
}
static void test(Double... d) {
System.out.println(Double.class);
}
}
JDK16 currently resolves and runs 'test(Double...)' instead of raising
a static error as mandated by §15.12 and according to the suggested
fix.
I'm not sure where to find JDK7 x86_64 binaries, so maybe you could
try this one too and share your thoughts?
Bernard
On Mon, 5 Oct 2020 at 12:00, Maurizio Cimadamore
<maurizio.cimadamore at oracle.com> wrote:
>
> Thanks - I've reset the fix version field and reassigned to Vicente - he
> can perhaps take a look and see what needs to be done to integrate this
> (this is an area where we would at least need some good testing
> coverage, perhaps by using the overload test framework that was put in
> few years ago - see [1] for an example).
>
> Maurizio
>
> [1] -
> https://github.com/openjdk/jdk/blob/master/test/langtools/tools/javac/resolve/tests/InnerOverOuter.java
More information about the compiler-dev
mailing list