Open
Description
Description
BaseStreamExample$CustomCollection.toArray() is being tried to call with null argument.
Though thee are 2 overloaded methods with different argument types.
To Reproduce
- Run the 'UTBotJava' project in IntelliJ Idea 2022.1.4
- Install one of the latest from main branch
- Open test generation dialog for utbot-sample/src/main/java/org/utbot/examples/stream/BaseStreamExample.java
- Select CustomCollection class
- click Generate Tests
- wait tests to be generated
Expected behavior
Generated tests should be compiled.
Actual behavior
There is a test method with Ambiguous method call
CE
Visual proofs
@Test
public void testToArray3() {
Object[] objectArray = {null, null, null, null, null, null, null, null, null};
CustomCollection customCollection = new CustomCollection(objectArray);
/* This test fails because method [generics.CustomCollection.toArray] produces [java.lang.NullPointerException]
java.base/java.util.Arrays$ArrayList.toArray(Arrays.java:4340)
generics.CustomCollection.toArray(CustomCollection.java:54) */
customCollection.toArray(null);
}
CE occurs in CustomCollection.toArray(null)
.
This happens, because we have two methods: CustomCollection::toArray(Object[])
and Collection::toArray(IntFunction)
defined in super interface of CustomCollection
.
Originally posted by @sergeypospelov in #1043 (comment)
Metadata
Metadata
Assignees
Type
Projects
Status
Todo