UseClass.java revision 3615:871b60b0c091
1/* 2 * Copyright (c) 2016, 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 24package jdk.jdeprusage; 25 26import jdk.deprcases.types.DeprecatedClass; 27 28public class UseClass { 29 static class Extends extends DeprecatedClass { 30 } 31 32 static class ClassLiteral { 33 Class<?> clazz = DeprecatedClass.class; 34 } 35 36 static class FieldType { 37 DeprecatedClass obj = null; 38 } 39 40 static class MethodParameter { 41 void foo(DeprecatedClass x) { } 42 } 43 44 static class MethodReturn { 45 DeprecatedClass foo() { return null; } 46 } 47 48 static class ArrayCreation { 49 Object foo() { 50 return new DeprecatedClass[1]; 51 } 52 } 53 54 static class ArrayFieldUsage { 55 int foo(Object o) { 56 return ((DeprecatedClass[])o).length; 57 } 58 } 59 60 static class ArrayMethodCall { 61 Object foo(Object o) { 62 return ((DeprecatedClass[])o).clone(); 63 } 64 } 65 66 static class InstanceOf { 67 boolean foo(Object o) { 68 return o instanceof DeprecatedClass; 69 } 70 } 71 72 static class Cast { 73 Object foo(Object o) { 74 return (DeprecatedClass)o; 75 } 76 } 77 78 static class Generic<T> { 79 static <U> void g() { } 80 } 81 82 static class ClassTypeArg extends Generic<DeprecatedClass> { } 83 84 static class MethodTypeArg { 85 void foo() { 86 Generic.<DeprecatedClass>g(); 87 } 88 } 89 90 static class ConstructorTypeArg { 91 Object foo() { 92 return new Generic<DeprecatedClass>(); 93 } 94 } 95 96 static class Construct { 97 Object foo() { 98 return new DeprecatedClass(); 99 } 100 } 101 102 static class Local { 103 void foo() { 104 DeprecatedClass obj = null; 105 } 106 } 107} 108