author | chegar |
Fri, 15 Apr 2016 16:19:15 +0100 | |
changeset 37363 | 329dba26ffd2 |
child 44668 | 1197afaf020a |
permissions | -rw-r--r-- |
37363
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
1 |
/* |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
2 |
* Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
4 |
* |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. Oracle designates this |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
8 |
* particular file as subject to the "Classpath" exception as provided |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
9 |
* by Oracle in the LICENSE file that accompanied this code. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
10 |
* |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
15 |
* accompanied this code). |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
16 |
* |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
17 |
* You should have received a copy of the GNU General Public License version |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
20 |
* |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
22 |
* or visit www.oracle.com if you need additional information or have any |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
23 |
* questions. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
24 |
*/ |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
25 |
|
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
26 |
package sun.reflect; |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
27 |
|
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
28 |
public class Reflection { |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
29 |
|
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
30 |
private Reflection() { } |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
31 |
|
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
32 |
/** |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
33 |
* @deprecated This method is an internal API and will be removed. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
34 |
* Use {@link StackWalker} to walk the stack and obtain the caller class |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
35 |
* with {@link StackWalker.StackFrame#getDeclaringClass} instead. |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
36 |
*/ |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
37 |
@Deprecated(forRemoval=true) |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
38 |
public static Class<?> getCallerClass(int depth) { |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
39 |
if (depth < 0) |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
40 |
throw new InternalError("depth must be positive"); |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
41 |
|
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
42 |
// increase depth to account for delegation to the internal impl |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
43 |
return jdk.internal.reflect.Reflection.getCallerClass(depth + 1); |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
44 |
} |
329dba26ffd2
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
diff
changeset
|
45 |
} |