Details
-
Bug
-
Resolution: Fixed
-
Blocker
-
2.0.0-alpha1
-
None
-
major
Description
`addArgument(Supplier<Object>)` prevents passing in any `Supplier<? extends Object>`.
Try the following JUnit 4 test:
import java.util.function.Supplier; import org.junit.Test; public class GenericsTest { @Test public void testObjectSupplier() { Supplier<Object> objectSupplier = () -> "Object"; Supplier<String> stringSupplier = () -> "String"; object(objectSupplier); //object(stringSupplier); // Uncommenting leads to compile failure //string(objectSupplier); // Uncommenting leads to compile failure string(stringSupplier); extendsObject(objectSupplier); // Works fine extendsObject(stringSupplier); // Works fine } private void object(Supplier<Object> objectSupplier) { System.out.println("object: "+objectSupplier.get()); } private void string(Supplier<String> stringSupplier) { System.out.println("string: "+stringSupplier.get()); } private void extendsObject(Supplier<?> extendsObjectSupplier) { System.out.println("extends object: "+extendsObjectSupplier.get()); } }