< prev index next >

src/java.base/share/classes/jdk/internal/reflect/Reflection.java

Print this page




  47     private static volatile Map<Class<?>,String[]> methodFilterMap;
  48 
  49     static {
  50         Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
  51         map.put(Reflection.class,
  52             new String[] {"fieldFilterMap", "methodFilterMap"});
  53         map.put(System.class, new String[] {"security"});
  54         map.put(Class.class, new String[] {"classLoader"});
  55         fieldFilterMap = map;
  56 
  57         methodFilterMap = new HashMap<>();
  58     }
  59 
  60     /** Returns the class of the caller of the method calling this method,
  61         ignoring frames associated with java.lang.reflect.Method.invoke()
  62         and its implementation. */
  63     @CallerSensitive
  64     @HotSpotIntrinsicCandidate
  65     public static native Class<?> getCallerClass();
  66 
  67     /**
  68      * @deprecated This method will be removed.
  69      * This method is a private JDK API and retained temporarily to
  70      * simplify the implementation of sun.misc.Reflection.getCallerClass.
  71      */
  72     @Deprecated(forRemoval=true)
  73     public static native Class<?> getCallerClass(int depth);
  74 
  75     /** Retrieves the access flags written to the class file. For
  76         inner classes these flags may differ from those returned by
  77         Class.getModifiers(), which searches the InnerClasses
  78         attribute to find the source-level access flags. This is used
  79         instead of Class.getModifiers() for run-time access checks due
  80         to compatibility reasons; see 4471811. Only the values of the
  81         low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
  82         valid. */
  83     @HotSpotIntrinsicCandidate
  84     public static native int getClassAccessFlags(Class<?> c);
  85 
  86 
  87     /**
  88      * Ensures that access to a member is granted and throws
  89      * IllegalAccessException if not.
  90      *
  91      * @param currentClass the class performing the access
  92      * @param memberClass the declaring class of the member being accessed
  93      * @param targetClass the class of target object if accessing instance
  94      *                    field or method;




  47     private static volatile Map<Class<?>,String[]> methodFilterMap;
  48 
  49     static {
  50         Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
  51         map.put(Reflection.class,
  52             new String[] {"fieldFilterMap", "methodFilterMap"});
  53         map.put(System.class, new String[] {"security"});
  54         map.put(Class.class, new String[] {"classLoader"});
  55         fieldFilterMap = map;
  56 
  57         methodFilterMap = new HashMap<>();
  58     }
  59 
  60     /** Returns the class of the caller of the method calling this method,
  61         ignoring frames associated with java.lang.reflect.Method.invoke()
  62         and its implementation. */
  63     @CallerSensitive
  64     @HotSpotIntrinsicCandidate
  65     public static native Class<?> getCallerClass();
  66 








  67     /** Retrieves the access flags written to the class file. For
  68         inner classes these flags may differ from those returned by
  69         Class.getModifiers(), which searches the InnerClasses
  70         attribute to find the source-level access flags. This is used
  71         instead of Class.getModifiers() for run-time access checks due
  72         to compatibility reasons; see 4471811. Only the values of the
  73         low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
  74         valid. */
  75     @HotSpotIntrinsicCandidate
  76     public static native int getClassAccessFlags(Class<?> c);
  77 
  78 
  79     /**
  80      * Ensures that access to a member is granted and throws
  81      * IllegalAccessException if not.
  82      *
  83      * @param currentClass the class performing the access
  84      * @param memberClass the declaring class of the member being accessed
  85      * @param targetClass the class of target object if accessing instance
  86      *                    field or method;


< prev index next >