9 * by Oracle in the LICENSE file that accompanied this code. 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 * 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.access; 27 28 import java.lang.annotation.Annotation; 29 import java.lang.module.ModuleDescriptor; 30 import java.lang.reflect.Executable; 31 import java.lang.reflect.Method; 32 import java.net.URI; 33 import java.nio.charset.CharacterCodingException; 34 import java.nio.charset.Charset; 35 import java.security.AccessControlContext; 36 import java.security.ProtectionDomain; 37 import java.util.Iterator; 38 import java.util.List; 39 import java.util.Map; 40 import java.util.concurrent.ConcurrentHashMap; 41 import java.util.stream.Stream; 42 43 import jdk.internal.module.ServicesCatalog; 44 import jdk.internal.reflect.ConstantPool; 45 import sun.reflect.annotation.AnnotationType; 46 import sun.nio.ch.Interruptible; 47 48 public interface JavaLangAccess { 131 */ 132 Thread newThreadWithAcc(Runnable target, AccessControlContext acc); 133 134 /** 135 * Invokes the finalize method of the given object. 136 */ 137 void invokeFinalize(Object o) throws Throwable; 138 139 /** 140 * Returns the ConcurrentHashMap used as a storage for ClassLoaderValue(s) 141 * associated with the given class loader, creating it if it doesn't already exist. 142 */ 143 ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl); 144 145 /** 146 * Defines a class with the given name to a class loader. 147 */ 148 Class<?> defineClass(ClassLoader cl, String name, byte[] b, ProtectionDomain pd, String source); 149 150 /** 151 * Returns a class loaded by the bootstrap class loader. 152 */ 153 Class<?> findBootstrapClassOrNull(ClassLoader cl, String name); 154 155 /** 156 * Define a Package of the given name and module by the given class loader. 157 */ 158 Package definePackage(ClassLoader cl, String name, Module module); 159 160 /** 161 * Invokes Long.fastUUID 162 */ 163 String fastUUID(long lsb, long msb); 164 165 /** 166 * Record the non-exported packages of the modules in the given layer 167 */ 168 void addNonExportedPackages(ModuleLayer layer); 169 170 /** 302 * 303 * @param s the string to encode 304 * @return the encoded bytes in utf8 305 * @throws IllegalArgumentException for malformed surrogates 306 */ 307 byte[] getBytesUTF8NoRepl(String s); 308 309 /** 310 * Set the cause of Throwable 311 * @param cause set t's cause to new value 312 */ 313 void setCause(Throwable t, Throwable cause); 314 315 /** 316 * Privileged System.loadLibrary 317 * 318 * @param caller on behalf of which the library is being loaded 319 * @param library name of the library to load 320 */ 321 void loadLibrary(Class<?> caller, String library); 322 } | 9 * by Oracle in the LICENSE file that accompanied this code. 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 * 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.access; 27 28 import java.lang.annotation.Annotation; 29 import java.lang.invoke.MethodHandle; 30 import java.lang.invoke.MethodType; 31 import java.lang.module.ModuleDescriptor; 32 import java.lang.reflect.Executable; 33 import java.lang.reflect.Method; 34 import java.net.URI; 35 import java.nio.charset.CharacterCodingException; 36 import java.nio.charset.Charset; 37 import java.security.AccessControlContext; 38 import java.security.ProtectionDomain; 39 import java.util.Iterator; 40 import java.util.List; 41 import java.util.Map; 42 import java.util.concurrent.ConcurrentHashMap; 43 import java.util.stream.Stream; 44 45 import jdk.internal.module.ServicesCatalog; 46 import jdk.internal.reflect.ConstantPool; 47 import sun.reflect.annotation.AnnotationType; 48 import sun.nio.ch.Interruptible; 49 50 public interface JavaLangAccess { 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 ConcurrentHashMap used as a storage for ClassLoaderValue(s) 143 * associated with the given class loader, creating it if it doesn't already exist. 144 */ 145 ConcurrentHashMap<?, ?> createOrGetClassLoaderValueMap(ClassLoader cl); 146 147 /** 148 * Defines a class with the given name to a class loader. 149 */ 150 Class<?> defineClass(ClassLoader cl, String name, byte[] b, ProtectionDomain pd, String source); 151 152 /** 153 * Defines a class with the given name to a class loader with 154 * the given flags and class data. 155 * 156 * @see java.lang.invoke.MethodHandles.Lookup#defineClass 157 */ 158 Class<?> defineClass(ClassLoader cl, Class<?> lookup, String name, byte[] b, ProtectionDomain pd, boolean initialize, int flags, Object classData); 159 160 /** 161 * Returns a class loaded by the bootstrap class loader. 162 */ 163 Class<?> findBootstrapClassOrNull(ClassLoader cl, String name); 164 165 /** 166 * Define a Package of the given name and module by the given class loader. 167 */ 168 Package definePackage(ClassLoader cl, String name, Module module); 169 170 /** 171 * Invokes Long.fastUUID 172 */ 173 String fastUUID(long lsb, long msb); 174 175 /** 176 * Record the non-exported packages of the modules in the given layer 177 */ 178 void addNonExportedPackages(ModuleLayer layer); 179 180 /** 312 * 313 * @param s the string to encode 314 * @return the encoded bytes in utf8 315 * @throws IllegalArgumentException for malformed surrogates 316 */ 317 byte[] getBytesUTF8NoRepl(String s); 318 319 /** 320 * Set the cause of Throwable 321 * @param cause set t's cause to new value 322 */ 323 void setCause(Throwable t, Throwable cause); 324 325 /** 326 * Privileged System.loadLibrary 327 * 328 * @param caller on behalf of which the library is being loaded 329 * @param library name of the library to load 330 */ 331 void loadLibrary(Class<?> caller, String library); 332 333 /** 334 * Get protection domain of the given Class 335 */ 336 ProtectionDomain protectionDomain(Class<?> c); 337 338 /** 339 * Get a method handle of string concat helper method 340 */ 341 MethodHandle stringConcatHelper(String name, MethodType methodType); 342 } |