src/share/classes/sun/reflect/Reflection.java

Print this page




  48             new String[] {"fieldFilterMap", "methodFilterMap"});
  49         map.put(System.class, new String[] {"security"});
  50         fieldFilterMap = map;
  51 
  52         methodFilterMap = new HashMap<Class,String[]>();
  53     }
  54 
  55     /** Returns the class of the caller of the method calling this method,
  56         ignoring frames associated with java.lang.reflect.Method.invoke()
  57         and its implementation. */
  58     @CallerSensitive
  59     public static native Class getCallerClass();
  60 
  61     /**
  62      * @deprecated No replacement.  This method will be removed in the next
  63      * JDK 7 update release.
  64      */
  65     @Deprecated
  66     @CallerSensitive
  67     public static Class getCallerClass(int depth) {
  68         return getCallerClass0(depth);

  69     }









  70 
  71     // If the VM enforces getting caller class with @CallerSensitive,
  72     // this will fail anyway.
  73     @CallerSensitive
  74     private static native Class getCallerClass0(int depth);
  75 
  76     /** Retrieves the access flags written to the class file. For
  77         inner classes these flags may differ from those returned by
  78         Class.getModifiers(), which searches the InnerClasses
  79         attribute to find the source-level access flags. This is used
  80         instead of Class.getModifiers() for run-time access checks due
  81         to compatibility reasons; see 4471811. Only the values of the
  82         low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
  83         valid. */
  84     private static native int getClassAccessFlags(Class c);
  85 
  86     /** A quick "fast-path" check to try to avoid getCallerClass()
  87         calls. */
  88     public static boolean quickCheckMemberAccess(Class memberClass,
  89                                                  int modifiers)




  48             new String[] {"fieldFilterMap", "methodFilterMap"});
  49         map.put(System.class, new String[] {"security"});
  50         fieldFilterMap = map;
  51 
  52         methodFilterMap = new HashMap<Class,String[]>();
  53     }
  54 
  55     /** Returns the class of the caller of the method calling this method,
  56         ignoring frames associated with java.lang.reflect.Method.invoke()
  57         and its implementation. */
  58     @CallerSensitive
  59     public static native Class getCallerClass();
  60 
  61     /**
  62      * @deprecated No replacement.  This method will be removed in the next
  63      * JDK 7 update release.
  64      */
  65     @Deprecated
  66     @CallerSensitive
  67     public static Class getCallerClass(int depth) {
  68         if (sun.misc.VM.allowGetCallerClass()) {
  69             return getCallerClass0(depth+1);
  70         }
  71         throw new UnsupportedOperationException("This method is in the sun.* namespace. " +
  72              "Such methods are not a supported, public interface. " +
  73              "As a temporary measure, the 7u40 release notes describe " +
  74              "a mechanism to reenable the historical functionality of " +
  75              "this method.  However, this method will be removed without " +
  76              "further warning in a subsequent 7 update release.  " +
  77              "Update code properly using this method to allow the code " +
  78              "to work on future 7 update releases.");
  79     }
  80 
  81     // If the VM enforces getting caller class with @CallerSensitive,
  82     // this will fail anyway.
  83     @CallerSensitive
  84     private static native Class getCallerClass0(int depth);
  85 
  86     /** Retrieves the access flags written to the class file. For
  87         inner classes these flags may differ from those returned by
  88         Class.getModifiers(), which searches the InnerClasses
  89         attribute to find the source-level access flags. This is used
  90         instead of Class.getModifiers() for run-time access checks due
  91         to compatibility reasons; see 4471811. Only the values of the
  92         low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
  93         valid. */
  94     private static native int getClassAccessFlags(Class c);
  95 
  96     /** A quick "fast-path" check to try to avoid getCallerClass()
  97         calls. */
  98     public static boolean quickCheckMemberAccess(Class memberClass,
  99                                                  int modifiers)