Thodoris Sotiropoulos created GROOVY-11053:
----------------------------------------------
Summary: Method ambiguity error when having methods with primitive
arrays and varargs
Key: GROOVY-11053
URL: https://issues.apache.org/jira/browse/GROOVY-11053
Project: Groovy
Issue Type: Bug
Components: Static Type Checker
Reporter: Thodoris Sotiropoulos
I have the following program (it uses the apache-commons-lang3 library)
{code}
class Main {
static final void test() {
final byte[] vetting = new byte[1];
final byte[] grafting =
org.apache.commons.lang3.ArrayUtils.removeAll(vetting); // works
final byte[] grafting =
org.apache.commons.lang3.ArrayUtils.removeAll(vetting, 0); // fails
}
}
{code}
h3. Actual behavior
{code}
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
groovy38.groovy: 4: [Static type checking] - Reference to method is ambiguous.
Cannot choose between [byte[]
org.apache.commons.lang3.ArrayUtils#removeAll(byte[], int[]), long[]
org.apache.commons.lang3.ArrayUtils#removeAll(long[], int[]), float[]
org.apache.commons.lang3.ArrayUtils#removeAll(float[], int[]), double[]
org.apache.commons.lang3.ArrayUtils#removeAll(double[], int[]), int[]
org.apache.commons.lang3.ArrayUtils#removeAll(int[], int[]), short[]
org.apache.commons.lang3.ArrayUtils#removeAll(short[], int[])]
@ line 4, column 29.
final byte[] grafting =
org.apache.commons.lang3.ArrayUtils.removeAll(vetting, 0);
^
1 error
{code}
h3. Expected behavior
Compile successfully
h3. Tested against master (commit: 7a4b2679c77aea8cd9dc00fa2d3b71e25e97fbd2)
--
This message was sent by Atlassian Jira
(v8.20.10#820010)