Test8027905.java revision 8726:29f979efbabf
178344Sobrien/* 278344Sobrien * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 398184Sgordon * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 498184Sgordon * 578344Sobrien * This code is free software; you can redistribute it and/or modify it 678344Sobrien * under the terms of the GNU General Public License version 2 only, as 778344Sobrien * published by the Free Software Foundation. 898184Sgordon * 998184Sgordon * This code is distributed in the hope that it will be useful, but WITHOUT 1078344Sobrien * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1178344Sobrien * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1278344Sobrien * version 2 for more details (a copy is included in the LICENSE file that 1378344Sobrien * accompanied this code). 1499550Sgordon * 1578344Sobrien * You should have received a copy of the GNU General Public License version 1678344Sobrien * 2 along with this work; if not, write to the Free Software Foundation, 1778344Sobrien * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1878344Sobrien * 1998184Sgordon * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2098184Sgordon * or visit www.oracle.com if you need additional information or have any 2198184Sgordon * questions. 2298184Sgordon */ 2398184Sgordon 2498184Sgordonimport java.beans.PropertyDescriptor; 2598184Sgordon 2698184Sgordon/* 2798184Sgordon * @test 2878344Sobrien * @bug 8027905 2978344Sobrien * @summary Tests that GC does not affect a property type 3098184Sgordon * @author Sergey Malenkov 3198184Sgordon */ 3298184Sgordon 3398184Sgordonpublic class Test8027905 { 3498184Sgordon public static void main(String[] args) { 3598486Sdougb PropertyDescriptor pd = BeanUtils.getPropertyDescriptor(Sub.class, "foo"); 3698486Sdougb Class<?> type = pd.getPropertyType(); 3798585Sdougb 3898486Sdougb int[] array = new int[10]; 3998184Sgordon while (array != null) { 4098184Sgordon try { 4198184Sgordon array = new int[array.length + array.length]; 4298184Sgordon } 4398184Sgordon catch (OutOfMemoryError error) { 4498184Sgordon array = null; 4598184Sgordon } 4698184Sgordon } 4798184Sgordon if (type != pd.getPropertyType()) { 4898184Sgordon throw new Error("property type is changed"); 4998184Sgordon } 5098184Sgordon } 5198184Sgordon 5298184Sgordon public static class Super<T> { 5398184Sgordon public T getFoo() { 5498184Sgordon return null; 5598184Sgordon } 5698184Sgordon 5778344Sobrien public void setFoo(T t) { 5898184Sgordon } 5978344Sobrien } 6078344Sobrien 6178344Sobrien public static class Sub extends Super<String> { 6278344Sobrien @Override 6378344Sobrien public String getFoo() { 64 return null; 65 } 66 67 @Override 68 public void setFoo(String t) { 69 } 70 } 71} 72