author | chegar |
Wed, 06 Jan 2016 10:01:44 +0000 | |
changeset 34882 | ce2a8ec851c1 |
parent 31671 | 362e0c0acece |
child 36511 | 9d0388c6b336 |
permissions | -rw-r--r-- |
2 | 1 |
/* |
20872
8e486b70dff8
8022718: Runtime accessibility checking: protected class, if extended, should be accessible from another package
drchase
parents:
16906
diff
changeset
|
2 |
* Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. |
2 | 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 |
|
5506 | 7 |
* published by the Free Software Foundation. Oracle designates this |
2 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5506 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
2 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5506 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
2 | 24 |
*/ |
25 |
||
26 |
package sun.reflect; |
|
27 |
||
28 |
import java.lang.reflect.*; |
|
29 |
import java.util.HashMap; |
|
30 |
import java.util.Map; |
|
31671
362e0c0acece
8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents:
31074
diff
changeset
|
31 |
import jdk.internal.HotSpotIntrinsicCandidate; |
34882 | 32 |
import jdk.internal.misc.VM; |
2 | 33 |
|
34 |
/** Common utility routines used by both java.lang and |
|
35 |
java.lang.reflect */ |
|
36 |
||
37 |
public class Reflection { |
|
38 |
||
39 |
/** Used to filter out fields and methods from certain classes from public |
|
40 |
view, where they are sensitive or they may contain VM-internal objects. |
|
41 |
These Maps are updated very rarely. Rather than synchronize on |
|
42 |
each access, we use copy-on-write */ |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
43 |
private static volatile Map<Class<?>,String[]> fieldFilterMap; |
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
44 |
private static volatile Map<Class<?>,String[]> methodFilterMap; |
2 | 45 |
|
46 |
static { |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
47 |
Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>(); |
2 | 48 |
map.put(Reflection.class, |
49 |
new String[] {"fieldFilterMap", "methodFilterMap"}); |
|
50 |
map.put(System.class, new String[] {"security"}); |
|
31074
0a91f3afaae7
8081320: Backout JDK-8059340: ConstantPool::_resolved_references is missing in heap dump
vlivanov
parents:
31071
diff
changeset
|
51 |
map.put(Class.class, new String[] {"classLoader"}); |
2 | 52 |
fieldFilterMap = map; |
53 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
54 |
methodFilterMap = new HashMap<>(); |
2 | 55 |
} |
56 |
||
16906
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
57 |
/** Returns the class of the caller of the method calling this method, |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
58 |
ignoring frames associated with java.lang.reflect.Method.invoke() |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
59 |
and its implementation. */ |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
60 |
@CallerSensitive |
31671
362e0c0acece
8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents:
31074
diff
changeset
|
61 |
@HotSpotIntrinsicCandidate |
16906
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
62 |
public static native Class<?> getCallerClass(); |
2 | 63 |
|
21284
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
64 |
/** |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
65 |
* @deprecated This method will be removed in JDK 9. |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
66 |
* This method is a private JDK API and retained temporarily for |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
67 |
* existing code to run until a replacement API is defined. |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
68 |
*/ |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
69 |
@Deprecated |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
70 |
public static native Class<?> getCallerClass(int depth); |
e6dfe841a88f
8025799: Restore sun.reflect.Reflection.getCallerClass(int) until a replacement API is provided
mchung
parents:
20872
diff
changeset
|
71 |
|
2 | 72 |
/** Retrieves the access flags written to the class file. For |
73 |
inner classes these flags may differ from those returned by |
|
74 |
Class.getModifiers(), which searches the InnerClasses |
|
75 |
attribute to find the source-level access flags. This is used |
|
76 |
instead of Class.getModifiers() for run-time access checks due |
|
77 |
to compatibility reasons; see 4471811. Only the values of the |
|
78 |
low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be |
|
79 |
valid. */ |
|
31671
362e0c0acece
8076112: Add @HotSpotIntrinsicCandidate annotation to indicate methods for which Java Runtime has intrinsics
zmajo
parents:
31074
diff
changeset
|
80 |
@HotSpotIntrinsicCandidate |
20872
8e486b70dff8
8022718: Runtime accessibility checking: protected class, if extended, should be accessible from another package
drchase
parents:
16906
diff
changeset
|
81 |
public static native int getClassAccessFlags(Class<?> c); |
2 | 82 |
|
83 |
/** A quick "fast-path" check to try to avoid getCallerClass() |
|
84 |
calls. */ |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
85 |
public static boolean quickCheckMemberAccess(Class<?> memberClass, |
2 | 86 |
int modifiers) |
87 |
{ |
|
88 |
return Modifier.isPublic(getClassAccessFlags(memberClass) & modifiers); |
|
89 |
} |
|
90 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
91 |
public static void ensureMemberAccess(Class<?> currentClass, |
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
92 |
Class<?> memberClass, |
2 | 93 |
Object target, |
94 |
int modifiers) |
|
95 |
throws IllegalAccessException |
|
96 |
{ |
|
97 |
if (currentClass == null || memberClass == null) { |
|
98 |
throw new InternalError(); |
|
99 |
} |
|
100 |
||
101 |
if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) { |
|
102 |
throw new IllegalAccessException("Class " + currentClass.getName() + |
|
103 |
" can not access a member of class " + |
|
104 |
memberClass.getName() + |
|
105 |
" with modifiers \"" + |
|
106 |
Modifier.toString(modifiers) + |
|
107 |
"\""); |
|
108 |
} |
|
109 |
} |
|
110 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
111 |
public static boolean verifyMemberAccess(Class<?> currentClass, |
2 | 112 |
// Declaring class of field |
113 |
// or method |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
114 |
Class<?> memberClass, |
2 | 115 |
// May be NULL in case of statics |
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
116 |
Object target, |
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
117 |
int modifiers) |
2 | 118 |
{ |
119 |
// Verify that currentClass can access a field, method, or |
|
120 |
// constructor of memberClass, where that member's access bits are |
|
121 |
// "modifiers". |
|
122 |
||
123 |
boolean gotIsSameClassPackage = false; |
|
124 |
boolean isSameClassPackage = false; |
|
125 |
||
126 |
if (currentClass == memberClass) { |
|
127 |
// Always succeeds |
|
128 |
return true; |
|
129 |
} |
|
130 |
||
131 |
if (!Modifier.isPublic(getClassAccessFlags(memberClass))) { |
|
132 |
isSameClassPackage = isSameClassPackage(currentClass, memberClass); |
|
133 |
gotIsSameClassPackage = true; |
|
134 |
if (!isSameClassPackage) { |
|
135 |
return false; |
|
136 |
} |
|
137 |
} |
|
138 |
||
139 |
// At this point we know that currentClass can access memberClass. |
|
140 |
||
141 |
if (Modifier.isPublic(modifiers)) { |
|
142 |
return true; |
|
143 |
} |
|
144 |
||
145 |
boolean successSoFar = false; |
|
146 |
||
147 |
if (Modifier.isProtected(modifiers)) { |
|
148 |
// See if currentClass is a subclass of memberClass |
|
149 |
if (isSubclassOf(currentClass, memberClass)) { |
|
150 |
successSoFar = true; |
|
151 |
} |
|
152 |
} |
|
153 |
||
154 |
if (!successSoFar && !Modifier.isPrivate(modifiers)) { |
|
155 |
if (!gotIsSameClassPackage) { |
|
156 |
isSameClassPackage = isSameClassPackage(currentClass, |
|
157 |
memberClass); |
|
158 |
gotIsSameClassPackage = true; |
|
159 |
} |
|
160 |
||
161 |
if (isSameClassPackage) { |
|
162 |
successSoFar = true; |
|
163 |
} |
|
164 |
} |
|
165 |
||
166 |
if (!successSoFar) { |
|
167 |
return false; |
|
168 |
} |
|
169 |
||
170 |
if (Modifier.isProtected(modifiers)) { |
|
171 |
// Additional test for protected members: JLS 6.6.2 |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
172 |
Class<?> targetClass = (target == null ? memberClass : target.getClass()); |
2 | 173 |
if (targetClass != currentClass) { |
174 |
if (!gotIsSameClassPackage) { |
|
175 |
isSameClassPackage = isSameClassPackage(currentClass, memberClass); |
|
176 |
gotIsSameClassPackage = true; |
|
177 |
} |
|
178 |
if (!isSameClassPackage) { |
|
179 |
if (!isSubclassOf(targetClass, currentClass)) { |
|
180 |
return false; |
|
181 |
} |
|
182 |
} |
|
183 |
} |
|
184 |
} |
|
185 |
||
186 |
return true; |
|
187 |
} |
|
188 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
189 |
private static boolean isSameClassPackage(Class<?> c1, Class<?> c2) { |
2 | 190 |
return isSameClassPackage(c1.getClassLoader(), c1.getName(), |
191 |
c2.getClassLoader(), c2.getName()); |
|
192 |
} |
|
193 |
||
194 |
/** Returns true if two classes are in the same package; classloader |
|
195 |
and classname information is enough to determine a class's package */ |
|
196 |
private static boolean isSameClassPackage(ClassLoader loader1, String name1, |
|
197 |
ClassLoader loader2, String name2) |
|
198 |
{ |
|
199 |
if (loader1 != loader2) { |
|
200 |
return false; |
|
201 |
} else { |
|
202 |
int lastDot1 = name1.lastIndexOf('.'); |
|
203 |
int lastDot2 = name2.lastIndexOf('.'); |
|
204 |
if ((lastDot1 == -1) || (lastDot2 == -1)) { |
|
205 |
// One of the two doesn't have a package. Only return true |
|
206 |
// if the other one also doesn't have a package. |
|
207 |
return (lastDot1 == lastDot2); |
|
208 |
} else { |
|
209 |
int idx1 = 0; |
|
210 |
int idx2 = 0; |
|
211 |
||
212 |
// Skip over '['s |
|
213 |
if (name1.charAt(idx1) == '[') { |
|
214 |
do { |
|
215 |
idx1++; |
|
216 |
} while (name1.charAt(idx1) == '['); |
|
217 |
if (name1.charAt(idx1) != 'L') { |
|
218 |
// Something is terribly wrong. Shouldn't be here. |
|
219 |
throw new InternalError("Illegal class name " + name1); |
|
220 |
} |
|
221 |
} |
|
222 |
if (name2.charAt(idx2) == '[') { |
|
223 |
do { |
|
224 |
idx2++; |
|
225 |
} while (name2.charAt(idx2) == '['); |
|
226 |
if (name2.charAt(idx2) != 'L') { |
|
227 |
// Something is terribly wrong. Shouldn't be here. |
|
228 |
throw new InternalError("Illegal class name " + name2); |
|
229 |
} |
|
230 |
} |
|
231 |
||
232 |
// Check that package part is identical |
|
233 |
int length1 = lastDot1 - idx1; |
|
234 |
int length2 = lastDot2 - idx2; |
|
235 |
||
236 |
if (length1 != length2) { |
|
237 |
return false; |
|
238 |
} |
|
239 |
return name1.regionMatches(false, idx1, name2, idx2, length1); |
|
240 |
} |
|
241 |
} |
|
242 |
} |
|
243 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
244 |
static boolean isSubclassOf(Class<?> queryClass, |
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
245 |
Class<?> ofClass) |
2 | 246 |
{ |
247 |
while (queryClass != null) { |
|
248 |
if (queryClass == ofClass) { |
|
249 |
return true; |
|
250 |
} |
|
251 |
queryClass = queryClass.getSuperclass(); |
|
252 |
} |
|
253 |
return false; |
|
254 |
} |
|
255 |
||
256 |
// fieldNames must contain only interned Strings |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
257 |
public static synchronized void registerFieldsToFilter(Class<?> containingClass, |
2 | 258 |
String ... fieldNames) { |
259 |
fieldFilterMap = |
|
260 |
registerFilter(fieldFilterMap, containingClass, fieldNames); |
|
261 |
} |
|
262 |
||
263 |
// methodNames must contain only interned Strings |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
264 |
public static synchronized void registerMethodsToFilter(Class<?> containingClass, |
2 | 265 |
String ... methodNames) { |
266 |
methodFilterMap = |
|
267 |
registerFilter(methodFilterMap, containingClass, methodNames); |
|
268 |
} |
|
269 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
270 |
private static Map<Class<?>,String[]> registerFilter(Map<Class<?>,String[]> map, |
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
271 |
Class<?> containingClass, String ... names) { |
2 | 272 |
if (map.get(containingClass) != null) { |
273 |
throw new IllegalArgumentException |
|
274 |
("Filter already registered: " + containingClass); |
|
275 |
} |
|
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
276 |
map = new HashMap<Class<?>,String[]>(map); |
2 | 277 |
map.put(containingClass, names); |
278 |
return map; |
|
279 |
} |
|
280 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
281 |
public static Field[] filterFields(Class<?> containingClass, |
2 | 282 |
Field[] fields) { |
283 |
if (fieldFilterMap == null) { |
|
284 |
// Bootstrapping |
|
285 |
return fields; |
|
286 |
} |
|
287 |
return (Field[])filter(fields, fieldFilterMap.get(containingClass)); |
|
288 |
} |
|
289 |
||
10342
ca0984bc9d32
7077389: Reflection classes do not build with javac -Xlint:all -Werror
jjg
parents:
5506
diff
changeset
|
290 |
public static Method[] filterMethods(Class<?> containingClass, Method[] methods) { |
2 | 291 |
if (methodFilterMap == null) { |
292 |
// Bootstrapping |
|
293 |
return methods; |
|
294 |
} |
|
295 |
return (Method[])filter(methods, methodFilterMap.get(containingClass)); |
|
296 |
} |
|
297 |
||
298 |
private static Member[] filter(Member[] members, String[] filteredNames) { |
|
299 |
if ((filteredNames == null) || (members.length == 0)) { |
|
300 |
return members; |
|
301 |
} |
|
302 |
int numNewMembers = 0; |
|
303 |
for (Member member : members) { |
|
304 |
boolean shouldSkip = false; |
|
305 |
for (String filteredName : filteredNames) { |
|
306 |
if (member.getName() == filteredName) { |
|
307 |
shouldSkip = true; |
|
308 |
break; |
|
309 |
} |
|
310 |
} |
|
311 |
if (!shouldSkip) { |
|
312 |
++numNewMembers; |
|
313 |
} |
|
314 |
} |
|
315 |
Member[] newMembers = |
|
316 |
(Member[])Array.newInstance(members[0].getClass(), numNewMembers); |
|
317 |
int destIdx = 0; |
|
318 |
for (Member member : members) { |
|
319 |
boolean shouldSkip = false; |
|
320 |
for (String filteredName : filteredNames) { |
|
321 |
if (member.getName() == filteredName) { |
|
322 |
shouldSkip = true; |
|
323 |
break; |
|
324 |
} |
|
325 |
} |
|
326 |
if (!shouldSkip) { |
|
327 |
newMembers[destIdx++] = member; |
|
328 |
} |
|
329 |
} |
|
330 |
return newMembers; |
|
331 |
} |
|
16906
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
332 |
|
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
333 |
/** |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
334 |
* Tests if the given method is caller-sensitive and the declaring class |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
335 |
* is defined by either the bootstrap class loader or extension class loader. |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
336 |
*/ |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
337 |
public static boolean isCallerSensitive(Method m) { |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
338 |
final ClassLoader loader = m.getDeclaringClass().getClassLoader(); |
34882 | 339 |
if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader)) { |
16906
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
340 |
return m.isAnnotationPresent(CallerSensitive.class); |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
341 |
} |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
342 |
return false; |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
343 |
} |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
344 |
|
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
345 |
private static boolean isExtClassLoader(ClassLoader loader) { |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
346 |
ClassLoader cl = ClassLoader.getSystemClassLoader(); |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
347 |
while (cl != null) { |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
348 |
if (cl.getParent() == null && cl == loader) { |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
349 |
return true; |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
350 |
} |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
351 |
cl = cl.getParent(); |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
352 |
} |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
353 |
return false; |
44dfee24cb71
8010117: Annotate jdk caller sensitive methods with @sun.reflect.CallerSensitive
mchung
parents:
14342
diff
changeset
|
354 |
} |
2 | 355 |
} |