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