-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8u51, 9
-
x86
-
os_x
FULL PRODUCT VERSION :
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Brick-o-Matic.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
The javac compiler fails to correctly bind to one of multiple versions of an overloaded method whenever the overloaded method signatures have varargs. This worked fine in version 1.8.0_05 and I can confirm it was broken in 1.8.0_25 and continues to be broken in version 1.8.0_45.
REGRESSION. Last worked in version 8u5
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No compile errors
ACTUAL -
foo.java:3: error: reference to foo is ambiguous
foo(true, "hello");
^
both method foo(Object,String,Object...) in foo and method foo(boolean,String,Object...) in foo match
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class foo {
public static void main(String... args) {
foo(true, "hello");
}
public static void foo(Object o, String string, Object... args) {
}
public static void foo(boolean b, String string, Object... args) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Change varargs to an array on the method signature or rename one of the methods to not make them overloaded. This is difficult when using libraries that we don't have control over.
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin Brick-o-Matic.local 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
The javac compiler fails to correctly bind to one of multiple versions of an overloaded method whenever the overloaded method signatures have varargs. This worked fine in version 1.8.0_05 and I can confirm it was broken in 1.8.0_25 and continues to be broken in version 1.8.0_45.
REGRESSION. Last worked in version 8u5
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile the code.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No compile errors
ACTUAL -
foo.java:3: error: reference to foo is ambiguous
foo(true, "hello");
^
both method foo(Object,String,Object...) in foo and method foo(boolean,String,Object...) in foo match
1 error
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
public class foo {
public static void main(String... args) {
foo(true, "hello");
}
public static void foo(Object o, String string, Object... args) {
}
public static void foo(boolean b, String string, Object... args) {
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Change varargs to an array on the method signature or rename one of the methods to not make them overloaded. This is difficult when using libraries that we don't have control over.
- relates to
-
JDK-8034223 Most-specific should not have any special treatment for boxed vs. unboxed types
-
- Closed
-