Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/misc/JavaLangAccess.java
38829 views
/*1* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package sun.misc;2627import java.lang.annotation.Annotation;28import java.lang.reflect.Executable;29import java.security.AccessControlContext;30import java.util.Map;3132import sun.reflect.ConstantPool;33import sun.reflect.annotation.AnnotationType;34import sun.nio.ch.Interruptible;3536public interface JavaLangAccess {37/** Return the constant pool for a class. */38ConstantPool getConstantPool(Class<?> klass);3940/**41* Compare-And-Swap the AnnotationType instance corresponding to this class.42* (This method only applies to annotation types.)43*/44boolean casAnnotationType(Class<?> klass, AnnotationType oldType, AnnotationType newType);4546/**47* Get the AnnotationType instance corresponding to this class.48* (This method only applies to annotation types.)49*/50AnnotationType getAnnotationType(Class<?> klass);5152/**53* Get the declared annotations for a given class, indexed by their types.54*/55Map<Class<? extends Annotation>, Annotation> getDeclaredAnnotationMap(Class<?> klass);5657/**58* Get the array of bytes that is the class-file representation59* of this Class' annotations.60*/61byte[] getRawClassAnnotations(Class<?> klass);6263/**64* Get the array of bytes that is the class-file representation65* of this Class' type annotations.66*/67byte[] getRawClassTypeAnnotations(Class<?> klass);6869/**70* Get the array of bytes that is the class-file representation71* of this Executable's type annotations.72*/73byte[] getRawExecutableTypeAnnotations(Executable executable);7475/**76* Returns the elements of an enum class or null if the77* Class object does not represent an enum type;78* the result is uncloned, cached, and shared by all callers.79*/80<E extends Enum<E>> E[] getEnumConstantsShared(Class<E> klass);8182/** Set thread's blocker field. */83void blockedOn(Thread t, Interruptible b);8485/**86* Registers a shutdown hook.87*88* It is expected that this method with registerShutdownInProgress=true89* is only used to register DeleteOnExitHook since the first file90* may be added to the delete on exit list by the application shutdown91* hooks.92*93* @params slot the slot in the shutdown hook array, whose element94* will be invoked in order during shutdown95* @params registerShutdownInProgress true to allow the hook96* to be registered even if the shutdown is in progress.97* @params hook the hook to be registered98*99* @throw IllegalStateException if shutdown is in progress and100* the slot is not valid to register.101*/102void registerShutdownHook(int slot, boolean registerShutdownInProgress, Runnable hook);103104/**105* Returns the number of stack frames represented by the given throwable.106*/107int getStackTraceDepth(Throwable t);108109/**110* Returns the ith StackTraceElement for the given throwable.111*/112StackTraceElement getStackTraceElement(Throwable t, int i);113114/**115* Returns a new string backed by the provided character array. The116* character array is not copied and must never be modified after the117* String is created, in order to fulfill String's contract.118*119* @param chars the character array to back the string120* @return a newly created string whose content is the character array121*/122String newStringUnsafe(char[] chars);123124/**125* Returns a new Thread with the given Runnable and an126* inherited AccessControlContext.127*/128Thread newThreadWithAcc(Runnable target, AccessControlContext acc);129130/**131* Invokes the finalize method of the given object.132*/133void invokeFinalize(Object o) throws Throwable;134}135136137