< prev index next >
test/java/lang/reflect/Constructor/GenericStringTest.java
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2004, 2006, 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
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
import java.lang.reflect.*;
--- 21,31 ----
* questions.
*/
/*
* @test
! * @bug 5033583 6316717 6470106 8161500
* @summary Check toGenericString() and toString() methods
* @author Joseph D. Darcy
*/
import java.lang.reflect.*;
*** 33,48 ****
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);
!
! for(Class<?> clazz: classList)
for(Constructor<?> ctor: clazz.getDeclaredConstructors()) {
ExpectedGenericString egs = ctor.getAnnotation(ExpectedGenericString.class);
String actual = ctor.toGenericString();
System.out.println(actual);
if (! egs.value().equals(actual)) {
--- 33,44 ----
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))
for(Constructor<?> ctor: clazz.getDeclaredConstructors()) {
ExpectedGenericString egs = ctor.getAnnotation(ExpectedGenericString.class);
String actual = ctor.toGenericString();
System.out.println(actual);
if (! egs.value().equals(actual)) {
< prev index next >