--- old/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java 2012-12-14 15:29:00.216000000 +0400 +++ new/test/java/io/Serializable/resolveProxyClass/NonPublicInterface.java 2012-12-14 15:28:59.184000000 +0400 @@ -22,14 +22,17 @@ */ /* @test - * @bug 4413817 + * @bug 4413817 8004928 * @summary Verify that ObjectInputStream.resolveProxyClass can properly * resolve a dynamic proxy class which implements a non-public * interface not defined in the latest user defined class loader. */ import java.io.*; -import java.lang.reflect.*; +import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.Proxy; public class NonPublicInterface { @@ -39,35 +42,19 @@ } } + public static final String nonPublicIntrfaceName = "java.util.zip.ZipConstants"; + public static void main(String[] args) throws Exception { - Class nonPublic = null; - String[] nonPublicInterfaces = new String[] { - "java.awt.Conditional", - "java.util.zip.ZipConstants", - "javax.swing.GraphicsWrapper", - "javax.swing.JPopupMenu$Popup", - "javax.swing.JTable$Resizable2", - "javax.swing.JTable$Resizable3", - "javax.swing.ToolTipManager$Popup", - "sun.audio.Format", - "sun.audio.HaePlayable", - "sun.tools.agent.StepConstants", - }; - for (int i = 0; i < nonPublicInterfaces.length; i++) { - try { - nonPublic = Class.forName(nonPublicInterfaces[i]); - break; - } catch (ClassNotFoundException ex) { - } - } - if (nonPublic == null) { - throw new Error("couldn't find system non-public interface"); + Class nonPublic = Class.forName(nonPublicIntrfaceName); + if (Modifier.isPublic(nonPublic.getModifiers())) { + throw new Error("Interface " + nonPublicIntrfaceName + + " is public and need to be changed!"); } ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oout = new ObjectOutputStream(bout); oout.writeObject(Proxy.newProxyInstance(nonPublic.getClassLoader(), - new Class[]{ nonPublic }, new Handler())); + new Class[]{ nonPublic }, new Handler())); oout.close(); ObjectInputStream oin = new ObjectInputStream( new ByteArrayInputStream(bout.toByteArray())); --- old/test/java/lang/management/CompilationMXBean/Basic.java 2012-12-14 15:29:06.790000000 +0400 +++ new/test/java/lang/management/CompilationMXBean/Basic.java 2012-12-14 15:29:05.861000000 +0400 @@ -23,10 +23,10 @@ /* * @test - * @bug 5011189 + * @bug 5011189 8004928 * @summary Unit test for java.lang.management.CompilationMXBean * - * @run main/othervm -Xcomp -Xbatch -Djava.awt.headless=true Basic + * @run main/othervm -Xcomp -Xbatch Basic */ import java.lang.management.*; @@ -65,8 +65,6 @@ java.util.Locale.getAvailableLocales(); java.security.Security.getProviders(); - java.awt.Toolkit.getDefaultToolkit(); - javax.swing.UIManager.getInstalledLookAndFeels(); java.nio.channels.spi.SelectorProvider.provider(); time = mb.getTotalCompilationTime(); --- old/test/java/lang/reflect/Generics/Probe.java 2012-12-14 15:29:13.459000000 +0400 +++ new/test/java/lang/reflect/Generics/Probe.java 2012-12-14 15:29:12.455000000 +0400 @@ -23,7 +23,7 @@ /* * @test - * @bug 5003916 6704655 6873951 6476261 + * @bug 5003916 6704655 6873951 6476261 8004928 * @summary Testing parsing of signatures attributes of nested classes * @author Joseph D. Darcy */ @@ -52,8 +52,7 @@ "java.util.HashMap$ValueIterator", "java.util.LinkedHashMap$EntryIterator", "java.util.LinkedHashMap$KeyIterator", - "java.util.LinkedHashMap$ValueIterator", - "javax.swing.JComboBox$AccessibleJComboBox"}) + "java.util.LinkedHashMap$ValueIterator"}) public class Probe { public static void main (String... args) throws Throwable { Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); --- old/test/java/lang/reflect/Proxy/ClassRestrictions.java 2012-12-14 15:29:19.726000000 +0400 +++ new/test/java/lang/reflect/Proxy/ClassRestrictions.java 2012-12-14 15:29:18.874000000 +0400 @@ -22,7 +22,7 @@ */ /* @test - * @bug 4227192 + * @bug 4227192 8004928 * @summary This is a test of the restrictions on the parameters that may * be passed to the Proxy.getProxyClass method. * @author Peter Jones @@ -31,6 +31,7 @@ * @run main ClassRestrictions */ +import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; import java.net.URLClassLoader; @@ -47,7 +48,9 @@ interface Bashful { void foo(); } - + + public static final String nonPublicIntrfaceName = "java.util.zip.ZipConstants"; + public static void main(String[] args) { System.err.println( @@ -65,7 +68,7 @@ try { interfaces = new Class[] { Object.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with java.lang.Object as interface"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -75,7 +78,7 @@ try { interfaces = new Class[] { Integer.TYPE }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with int.class as interface"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -90,7 +93,7 @@ try { interfaces = new Class[] { Bar.class, Bar.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with repeated interfaces"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -109,7 +112,7 @@ try { interfaces = new Class[] { altBarClass }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with interface " + "not visible to class loader"); } catch (IllegalArgumentException e) { @@ -122,34 +125,16 @@ * All non-public interfaces must be in the same package. */ Class nonPublic1 = Bashful.class; - Class nonPublic2 = null; - String[] nonPublicInterfaces = new String[] { - "java.awt.Conditional", - "java.util.zip.ZipConstants", - "javax.swing.GraphicsWrapper", - "javax.swing.JPopupMenu$Popup", - "javax.swing.JTable$Resizable2", - "javax.swing.JTable$Resizable3", - "javax.swing.ToolTipManager$Popup", - "sun.audio.Format", - "sun.audio.HaePlayable", - "sun.tools.agent.StepConstants", - }; - for (int i = 0; i < nonPublicInterfaces.length; i++) { - try { - nonPublic2 = Class.forName(nonPublicInterfaces[i]); - break; - } catch (ClassNotFoundException e) { - } - } - if (nonPublic2 == null) { - throw new RuntimeException( - "no second non-public interface found for test"); + Class nonPublic2 = Class.forName(nonPublicIntrfaceName); + if (Modifier.isPublic(nonPublic2.getModifiers())) { + throw new Error( + "Interface " + nonPublicIntrfaceName + + " is public and need to be changed!"); } try { interfaces = new Class[] { nonPublic1, nonPublic2 }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with two non-public interfaces " + "in different packages"); } catch (IllegalArgumentException e) { @@ -165,7 +150,7 @@ try { interfaces = new Class[] { Bar.class, Baz.class }; proxyClass = Proxy.getProxyClass(loader, interfaces); - throw new RuntimeException( + throw new Error( "proxy class created with conflicting methods"); } catch (IllegalArgumentException e) { e.printStackTrace(); @@ -178,10 +163,10 @@ */ System.err.println("\nTEST PASSED"); - } catch (Exception e) { + } catch (Throwable e) { System.err.println("\nTEST FAILED:"); e.printStackTrace(); - throw new RuntimeException("TEST FAILED: " + e.toString()); + throw new Error("TEST FAILED: ", e); } } } --- old/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java 2012-12-14 15:29:25.670000000 +0400 +++ new/test/java/lang/Throwable/LegacyChainedExceptionSerialization.java 2012-12-14 15:29:24.880000000 +0400 @@ -25,7 +25,7 @@ /** * @test - * @bug 4385429 + * @bug 4385429 8004928 * @summary Certain legacy chained exceptions throw IllegalArgumentException * upon deserialization if "causative exception" is null. * @author Josh Bloch @@ -36,8 +36,7 @@ new ExceptionInInitializerError(), new java.lang.reflect.UndeclaredThrowableException(null), new java.lang.reflect.InvocationTargetException(null), - new java.security.PrivilegedActionException(null), - new java.awt.print.PrinterIOException(null) + new java.security.PrivilegedActionException(null) }; public static void main(String[] args) throws Exception { --- old/test/java/util/Collections/EmptyIterator.java 2012-12-14 15:29:31.539000000 +0400 +++ new/test/java/util/Collections/EmptyIterator.java 2012-12-14 15:29:30.643000000 +0400 @@ -23,15 +23,15 @@ /* * @test - * @bug 5017904 6356890 + * @bug 5017904 6356890 8004928 * @summary Test empty iterators, enumerations, and collections */ -import java.util.*; import static java.util.Collections.*; +import java.util.*; public class EmptyIterator { - + void test(String[] args) throws Throwable { testEmptyCollection(Collections.emptyList()); testEmptyCollection(Collections.emptySet()); @@ -45,10 +45,13 @@ testEmptyIterator(emptyTable.values().iterator()); testEmptyIterator(emptyTable.entrySet().iterator()); - testEmptyEnumeration(javax.swing.tree.DefaultMutableTreeNode - .EMPTY_ENUMERATION); - testEmptyEnumeration(javax.swing.text.SimpleAttributeSet - .EMPTY.getAttributeNames()); + final Enumeration finalEmptyTyped = + Collections.emptyEnumeration(); + testEmptyEnumeration(finalEmptyTyped); + + final Enumeration finalEmptyAbstract = + Collections.emptyEnumeration(); + testEmptyEnumeration(finalEmptyAbstract); @SuppressWarnings("unchecked") Iterator x = new sun.tools.java.MethodSet() --- old/test/java/util/logging/LoggingDeadlock4.java 2012-12-14 15:29:37.841000000 +0400 +++ new/test/java/util/logging/LoggingDeadlock4.java 2012-12-14 15:29:36.864000000 +0400 @@ -23,11 +23,11 @@ /* * @test - * @bug 6977677 + * @bug 6977677 8004928 * @summary Deadlock between LogManager. and Logger.getLogger() * @author Daniel D. Daugherty - * @build LoggingDeadlock4 - * @run main/othervm/timeout=15 -Djava.awt.headless=true LoggingDeadlock4 + * @compile -XDignore.symbol.file LoggingDeadlock4.java + * @run main/othervm/timeout=15 LoggingDeadlock4 */ import java.util.concurrent.CountDownLatch; @@ -39,21 +39,16 @@ private static CountDownLatch lmIsRunning = new CountDownLatch(1); private static CountDownLatch logIsRunning = new CountDownLatch(1); + // Create a sun.util.logging.PlatformLogger$JavaLogger object + // that has to be redirected when the LogManager class + // is initialized. This can cause a deadlock between + // LogManager. and Logger.getLogger(). + private static final sun.util.logging.PlatformLogger log = + sun.util.logging.PlatformLogger.getLogger("java.util.logging"); + public static void main(String[] args) { System.out.println("main: LoggingDeadlock4 is starting."); - // Loading the java.awt.Container class will create a - // sun.util.logging.PlatformLogger$JavaLogger object - // that has to be redirected when the LogManager class - // is initialized. This can cause a deadlock between - // LogManager. and Logger.getLogger(). - try { - Class.forName("java.awt.Container"); - } catch (ClassNotFoundException cnfe) { - throw new RuntimeException("Test failed: could not load" - + " java.awt.Container." + cnfe); - } - Thread lmThread = new Thread("LogManagerThread") { public void run() { // let main know LogManagerThread is running --- old/test/sun/tools/jrunscript/common.sh 2012-12-14 15:29:44.615000000 +0400 +++ new/test/sun/tools/jrunscript/common.sh 2012-12-14 15:29:43.597000000 +0400 @@ -63,8 +63,4 @@ JRUNSCRIPT="${TESTJAVA}/bin/jrunscript" JAVAC="${TESTJAVA}/bin/javac" JAVA="${TESTJAVA}/bin/java" - # needed to get full headless behavior on Mac - if [ "$OS" = "Darwin" ]; then - export AWT_TOOLKIT=XToolkit - fi }