[email protected] writes: > Author: bpendleton > Date: Sat May 7 21:20:42 2016 > New Revision: 1742756 > > URL: http://svn.apache.org/viewvc?rev=1742756&view=rev > Log: > DERBY-6856: Make it possible to build Derby using JDK 9 > > This change reverts one particular change from revision 1742289. > > The java.util.List class supports two remove methods: > remove(Object o) and remove(int i). In the DatabaseMetaDataTest's > testGetTypeInfo test, there is a List<Integer>, and changing > the autoboxing code to call remove(Types.BOOLEAN) rather than > remove(new Integer(Types.BOOLEAN)) caused the JDK 8 compiler to > choose remove(int i) rather than remove(Object o), thus > causing failures in the upgrade test suite. > > This change returns the test code to using the explicit > object creation in order to ensure we call remove(Object o). > > > Modified: > > db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java > > Modified: > db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java > URL: > http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=1742756&r1=1742755&r2=1742756&view=diff > ============================================================================== > --- > db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java > (original) > +++ > db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java > Sat May 7 21:20:42 2016 > @@ -2325,7 +2325,7 @@ public class DatabaseMetaDataTest extend > // DERBY-4946: Boolean isn't supported if DB is soft-upgraded from > // pre-10.7 version > if (!booleanSupported) { > - supportedTypes.remove(Types.BOOLEAN); > + supportedTypes.remove(new Integer(Types.BOOLEAN));
Good catch! I think supportedTypes.remove(Integer.valueOf(Types.BOOLEAN)); would have the additional benefits of removing the warning on JDK 9 and using the internal cache of Integer objects to avoid allocation, while still picking the correct overload of List.remove(). > } > > // Rows are returned from getTypeInfo in order of -- Knut Anders
