--- jsr166/src/test/tck/Collection8Test.java 2016/11/13 02:10:10 1.22 +++ jsr166/src/test/tck/Collection8Test.java 2016/11/14 23:52:22 1.24 @@ -61,12 +61,23 @@ public class Collection8Test extends JSR } /** Checks properties of empty collections. */ - public void testEmptyMeansEmpty() throws InterruptedException { + public void testEmptyMeansEmpty() throws Throwable { Collection c = impl.emptyCollection(); emptyMeansEmpty(c); - if (c instanceof java.io.Serializable) - emptyMeansEmpty(serialClone(c)); + if (c instanceof java.io.Serializable) { + try { + emptyMeansEmpty(serialClonePossiblyFailing(c)); + } catch (java.io.NotSerializableException ex) { + // excusable when we have a serializable wrapper around + // a non-serializable collection, as can happen with: + // Vector.subList() => wrapped AbstractList$RandomAccessSubList + if (testImplementationDetails + && (! c.getClass().getName().matches( + "java.util.Collections.*"))) + throw ex; + } + } Collection clone = cloneableClone(c); if (clone != null) @@ -314,7 +325,9 @@ public class Collection8Test extends JSR } } catch (Throwable ex) { System.err.println(impl.klazz()); - System.err.printf("c=%s%n", c); + // c is at risk of corruption if we got here, so be lenient + try { System.err.printf("c=%s%n", c); } + catch (Throwable t) { t.printStackTrace(); } System.err.printf("n=%d%n", n); System.err.printf("orig=%s%n", orig); System.err.printf("accepts=%s%n", accepts);