1 /* 2 * Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 5003916 6704655 6873951 27 * @summary Testing parsing of signatures attributes of nested classes 28 * @author Joseph D. Darcy 29 */ 30 31 import java.lang.reflect.*; 32 import java.lang.annotation.*; 33 import java.util.*; 34 import static java.util.Arrays.*; 35 36 @Classes({"java.util.concurrent.FutureTask", 37 "java.util.concurrent.ConcurrentHashMap$EntryIterator", 38 "java.util.concurrent.ConcurrentHashMap$KeyIterator", 39 "java.util.concurrent.ConcurrentHashMap$ValueIterator", 40 "java.util.AbstractList$ListItr", 41 // "java.util.EnumMap$EntryIterator", 42 // "java.util.EnumMap$KeyIterator", 43 // "java.util.EnumMap$ValueIterator", 44 // "java.util.IdentityHashMap$EntryIterator", 45 // "java.util.IdentityHashMap$KeyIterator", 46 // "java.util.IdentityHashMap$ValueIterator", 47 "java.util.WeakHashMap$EntryIterator", 48 "java.util.WeakHashMap$KeyIterator", 49 "java.util.WeakHashMap$ValueIterator", 50 "java.util.HashMap$EntryIterator", 51 "java.util.HashMap$KeyIterator", 52 "java.util.HashMap$ValueIterator", 53 "java.util.LinkedHashMap$EntryIterator", 54 "java.util.LinkedHashMap$KeyIterator", 55 "java.util.LinkedHashMap$ValueIterator"}) 56 public class Probe { 57 public static void main (String... args) throws Throwable { 58 Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); 59 List<String> names = 60 new ArrayList<String>(asList(classesAnnotation.value())); 61 62 int errs = 0; 63 for(String name: names) { 64 System.out.println("\nCLASS " + name); 65 Class c = Class.forName(name, false, null); 66 errs += probe(c); 67 System.out.println(errs == 0 ? " ok" : " ERRORS:" + errs); 68 } 69 70 if (errs > 0 ) 71 throw new RuntimeException("Errors during probing."); 72 } 73 74 static int probe (Class c) { 75 int errs = 0; 76 77 try { 78 c.getTypeParameters(); 79 c.getGenericSuperclass(); 80 c.getGenericInterfaces(); | 1 /* 2 * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 24 /* 25 * @test 26 * @bug 5003916 6704655 6873951 6476261 27 * @summary Testing parsing of signatures attributes of nested classes 28 * @author Joseph D. Darcy 29 */ 30 31 import java.lang.reflect.*; 32 import java.lang.annotation.*; 33 import java.util.*; 34 import static java.util.Arrays.*; 35 36 @Classes({"java.util.concurrent.FutureTask", 37 "java.util.concurrent.ConcurrentHashMap$EntryIterator", 38 "java.util.concurrent.ConcurrentHashMap$KeyIterator", 39 "java.util.concurrent.ConcurrentHashMap$ValueIterator", 40 "java.util.AbstractList$ListItr", 41 "java.util.EnumMap$EntryIterator", 42 "java.util.EnumMap$KeyIterator", 43 "java.util.EnumMap$ValueIterator", 44 "java.util.IdentityHashMap$EntryIterator", 45 "java.util.IdentityHashMap$KeyIterator", 46 "java.util.IdentityHashMap$ValueIterator", 47 "java.util.WeakHashMap$EntryIterator", 48 "java.util.WeakHashMap$KeyIterator", 49 "java.util.WeakHashMap$ValueIterator", 50 "java.util.HashMap$EntryIterator", 51 "java.util.HashMap$KeyIterator", 52 "java.util.HashMap$ValueIterator", 53 "java.util.LinkedHashMap$EntryIterator", 54 "java.util.LinkedHashMap$KeyIterator", 55 "java.util.LinkedHashMap$ValueIterator", 56 "javax.swing.JComboBox$AccessibleJComboBox"}) 57 public class Probe { 58 public static void main (String... args) throws Throwable { 59 Classes classesAnnotation = (Probe.class).getAnnotation(Classes.class); 60 List<String> names = new ArrayList<>(asList(classesAnnotation.value())); 61 62 int errs = 0; 63 for(String name: names) { 64 System.out.println("\nCLASS " + name); 65 Class c = Class.forName(name, false, null); 66 errs += probe(c); 67 System.out.println(errs == 0 ? " ok" : " ERRORS:" + errs); 68 } 69 70 if (errs > 0 ) 71 throw new RuntimeException("Errors during probing."); 72 } 73 74 static int probe (Class c) { 75 int errs = 0; 76 77 try { 78 c.getTypeParameters(); 79 c.getGenericSuperclass(); 80 c.getGenericInterfaces(); |