diff --git a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java index 71e55adb5..c18130953 100644 --- a/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java +++ b/src/test/java/org/apache/commons/collections4/collection/AbstractCollectionTest.java @@ -1084,7 +1084,8 @@ public abstract class AbstractCollectionTest extends AbstractObjectTest { verify(); try { - array = getCollection().toArray(null); + // Casting to Object[] allows compilation on Java 11. + array = getCollection().toArray((Object[]) null); fail("toArray(null) should raise NPE"); } catch (final NullPointerException e) { // expected