88 |
|
|
89 |
/** |
/** |
90 |
* Get the class loader associated with the Class returned by |
* Get the class loader associated with the Class returned by |
91 |
* <code>getCallingClass()</code>, or <code>null</code> if no |
* <code>getCallingClass()</code>, or <code>null</code> if no such class |
92 |
* such class exists or it is the boot loader. This method is an optimization |
* exists or it is the boot loader. This method is an optimization for the |
93 |
* for the expression <code>getClassContext()[1].getClassLoader()</code> |
* expression <code>VMStackWalker.getClassLoader(getClassContext()[1])</code> |
94 |
* and should return the same result. |
* and should return the same result. |
95 |
* |
* |
96 |
* <p> |
* <p> |
102 |
Class[] ctx = getClassContext(); |
Class[] ctx = getClassContext(); |
103 |
if (ctx.length < 3) |
if (ctx.length < 3) |
104 |
return null; |
return null; |
105 |
return ctx[2].getClassLoader(); |
return getClassLoader(ctx[2]); |
106 |
} |
} |
107 |
|
|
108 |
|
/** |
109 |
|
* Retrieve the class's ClassLoader, or <code>null</code> if loaded |
110 |
|
* by the bootstrap loader. I.e., this should return the same thing |
111 |
|
* as {@link java.lang.VMClass#getClassLoader}. This duplicate version |
112 |
|
* is here to work around access permissions. |
113 |
|
*/ |
114 |
|
public static native ClassLoader getClassLoader(Class cl); |
115 |
} |
} |
116 |
|
|