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 *
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.
24 */
25
26 package jdk.internal.misc;
27
28 import java.io.IOException;
29 import java.lang.annotation.Annotation;
30 import java.lang.reflect.Executable;
31 import java.lang.reflect.Layer;
32 import java.lang.reflect.Method;
33 import java.lang.reflect.Module;
34 import java.net.URL;
35 import java.security.AccessControlContext;
36 import java.util.Map;
37 import java.util.concurrent.ConcurrentHashMap;
38 import java.util.stream.Stream;
39
40 import jdk.internal.reflect.ConstantPool;
41 import sun.reflect.annotation.AnnotationType;
42 import sun.nio.ch.Interruptible;
43
44 public interface JavaLangAccess {
45
46 /**
47 * Returns a {@code Method} object that reflects the specified public
48 * member method of the given class. Returns {@code null} if the
49 * method is not defined.
50 */
51 Method getMethodOrNull(Class<?> klass, String name, Class<?>... parameterTypes);
52
53 /** Return the constant pool for a class. */
54 ConstantPool getConstantPool(Class<?> klass);
55
133 */
134 Thread newThreadWithAcc(Runnable target, AccessControlContext acc);
135
136 /**
137 * Invokes the finalize method of the given object.
138 */
139 void invokeFinalize(Object o) throws Throwable;
140
141 /**
142 * Returns the boot Layer
143 */
144 Layer getBootLayer();
145
146 /**
147 * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s)
148 * associated with the given class loader, creating it if it doesn't already exist.
149 */
150 ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl);
151
152 /**
153 * Returns a class loaded by the bootstrap class loader.
154 */
155 Class<?> findBootstrapClassOrNull(ClassLoader cl, String name);
156
157 /**
158 * Returns a URL to a resource with the given name in a module that is
159 * defined to the given class loader.
160 */
161 URL findResource(ClassLoader cl, String moduleName, String name) throws IOException;
162
163 /**
164 * Returns the Packages for the given class loader.
165 */
166 Stream<Package> packages(ClassLoader cl);
167
168 /**
169 * Define a Package of the given name and module by the given class loader.
170 */
171 Package definePackage(ClassLoader cl, String name, Module module);
172
|
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 *
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.
24 */
25
26 package jdk.internal.misc;
27
28 import java.io.IOException;
29 import java.lang.annotation.Annotation;
30 import java.lang.reflect.Executable;
31 import java.lang.reflect.Layer;
32 import java.lang.reflect.Method;
33 import java.lang.reflect.Module;
34 import java.net.URL;
35 import java.security.AccessControlContext;
36 import java.security.ProtectionDomain;
37 import java.util.Map;
38 import java.util.concurrent.ConcurrentHashMap;
39 import java.util.stream.Stream;
40
41 import jdk.internal.reflect.ConstantPool;
42 import sun.reflect.annotation.AnnotationType;
43 import sun.nio.ch.Interruptible;
44
45 public interface JavaLangAccess {
46
47 /**
48 * Returns a {@code Method} object that reflects the specified public
49 * member method of the given class. Returns {@code null} if the
50 * method is not defined.
51 */
52 Method getMethodOrNull(Class<?> klass, String name, Class<?>... parameterTypes);
53
54 /** Return the constant pool for a class. */
55 ConstantPool getConstantPool(Class<?> klass);
56
134 */
135 Thread newThreadWithAcc(Runnable target, AccessControlContext acc);
136
137 /**
138 * Invokes the finalize method of the given object.
139 */
140 void invokeFinalize(Object o) throws Throwable;
141
142 /**
143 * Returns the boot Layer
144 */
145 Layer getBootLayer();
146
147 /**
148 * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s)
149 * associated with the given class loader, creating it if it doesn't already exist.
150 */
151 ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl);
152
153 /**
154 * Defines a class with the given name to a class loader.
155 */
156 Class<?> defineClass(ClassLoader cl, String name, byte[] b, ProtectionDomain pd, String source);
157
158 /**
159 * Returns a class loaded by the bootstrap class loader.
160 */
161 Class<?> findBootstrapClassOrNull(ClassLoader cl, String name);
162
163 /**
164 * Returns a URL to a resource with the given name in a module that is
165 * defined to the given class loader.
166 */
167 URL findResource(ClassLoader cl, String moduleName, String name) throws IOException;
168
169 /**
170 * Returns the Packages for the given class loader.
171 */
172 Stream<Package> packages(ClassLoader cl);
173
174 /**
175 * Define a Package of the given name and module by the given class loader.
176 */
177 Package definePackage(ClassLoader cl, String name, Module module);
178
|