< prev index next >

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

Print this page

 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.reflect;
 27 
 28 import java.lang.reflect.*;
 29 import java.util.HashMap;
 30 import java.util.Map;
 31 import java.util.Objects;
 32 import java.util.Set;
 33 
 34 import jdk.internal.access.JavaLangAccess;
 35 import jdk.internal.access.SharedSecrets;
 36 import jdk.internal.misc.VM;
 37 import jdk.internal.module.ModuleBootstrap;
 38 import jdk.internal.vm.annotation.ForceInline;
 39 import jdk.internal.vm.annotation.IntrinsicCandidate;
 40 
 41 /** Common utility routines used by both java.lang and
 42     java.lang.reflect */
 43 
 44 public class Reflection {
 45 
 46     /** Used to filter out fields and methods from certain classes from public
 47         view, where they are sensitive or they may contain VM-internal objects.
 48         These Maps are updated very rarely. Rather than synchronize on
 49         each access, we use copy-on-write */
 50     private static volatile Map<Class<?>, Set<String>> fieldFilterMap;
 51     private static volatile Map<Class<?>, Set<String>> methodFilterMap;
 52     private static final String WILDCARD = "*";
 53     public static final Set<String> ALL_MEMBERS = Set.of(WILDCARD);
 54 
 55     static {
 56         fieldFilterMap = Map.of(
 57             Reflection.class, ALL_MEMBERS,

 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.reflect;
 27 
 28 import java.lang.reflect.*;
 29 import java.util.HashMap;
 30 import java.util.Map;
 31 import java.util.Objects;
 32 import java.util.Set;
 33 
 34 import jdk.internal.access.JavaLangAccess;
 35 import jdk.internal.access.SharedSecrets;
 36 import jdk.internal.misc.VM;

 37 import jdk.internal.vm.annotation.ForceInline;
 38 import jdk.internal.vm.annotation.IntrinsicCandidate;
 39 
 40 /** Common utility routines used by both java.lang and
 41     java.lang.reflect */
 42 
 43 public class Reflection {
 44 
 45     /** Used to filter out fields and methods from certain classes from public
 46         view, where they are sensitive or they may contain VM-internal objects.
 47         These Maps are updated very rarely. Rather than synchronize on
 48         each access, we use copy-on-write */
 49     private static volatile Map<Class<?>, Set<String>> fieldFilterMap;
 50     private static volatile Map<Class<?>, Set<String>> methodFilterMap;
 51     private static final String WILDCARD = "*";
 52     public static final Set<String> ALL_MEMBERS = Set.of(WILDCARD);
 53 
 54     static {
 55         fieldFilterMap = Map.of(
 56             Reflection.class, ALL_MEMBERS,
< prev index next >