< prev index next >
test/java/lang/reflect/Method/GenericStringTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 21,31 ****
* questions.
*/
/*
* @test
! * @bug 5033583 6316717 6470106 8004979
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
import java.lang.reflect.*;
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 5033583 6316717 6470106 8004979 8161500
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
import java.lang.reflect.*;
*** 33,50 ****
import java.util.*;
public class GenericStringTest {
public static void main(String argv[]) throws Exception {
int failures = 0;
- List<Class<?>> classList = new LinkedList<Class<?>>();
- classList.add(TestClass1.class);
- classList.add(TestClass2.class);
- classList.add(Roebling.class);
- classList.add(TestInterface1.class);
!
! for(Class<?> clazz: classList)
for(Method method: clazz.getDeclaredMethods()) {
ExpectedGenericString egs = method.getAnnotation(ExpectedGenericString.class);
if (egs != null) {
String actual = method.toGenericString();
System.out.println(actual);
--- 33,45 ----
import java.util.*;
public class GenericStringTest {
public static void main(String argv[]) throws Exception {
int failures = 0;
! for(Class<?> clazz: List.of(TestClass1.class, TestClass2.class,
! Roebling.class, TestInterface1.class))
for(Method method: clazz.getDeclaredMethods()) {
ExpectedGenericString egs = method.getAnnotation(ExpectedGenericString.class);
if (egs != null) {
String actual = method.toGenericString();
System.out.println(actual);
*** 119,128 ****
--- 114,147 ----
public <T> T method1(E e, T t) {return null;}
@ExpectedGenericString(
"public void TestClass2.method2() throws F")
public void method2() throws F {return;}
+
+ @ExpectedGenericString(
+ "public E[] TestClass2.method3()")
+ public E[] method3() {return null;}
+
+ @ExpectedGenericString(
+ "public E[][] TestClass2.method4()")
+ public E[][] method4() {return null;}
+
+ @ExpectedGenericString(
+ "public java.util.List<E[]> TestClass2.method5()")
+ public List<E[]> method5() {return null;}
+
+ @ExpectedGenericString(
+ "public java.util.List<?> TestClass2.method6()")
+ public List<?> method6() {return null;}
+
+ @ExpectedGenericString(
+ "public java.util.List<?>[] TestClass2.method7()")
+ public List<?>[] method7() {return null;}
+
+ @ExpectedGenericString(
+ "public <K,V> java.util.Map<K, V> TestClass2.method8()")
+ public <K, V> Map<K, V> method8() {return null;}
}
class Roebling implements Comparable<Roebling> {
@ExpectedGenericString(
value="public int Roebling.compareTo(Roebling)",
*** 155,165 ****
@ExpectedString(
"public default strictfp double TestInterface1.quux()")
@ExpectedGenericString(
"public default strictfp double TestInterface1.quux()")
strictfp default double quux(){return 1.0;}
-
}
@Retention(RetentionPolicy.RUNTIME)
@interface ExpectedGenericString {
String value();
--- 174,183 ----
< prev index next >