8214696: Module class should be filtered by core reflection
authoralanb
Thu, 13 Dec 2018 09:02:52 +0000
changeset 53005 888592cdb2d0
parent 53004 b9d34a97a4be
child 53006 4debb3321e65
8214696: Module class should be filtered by core reflection Reviewed-by: lancea, mchung, sundar
src/java.base/share/classes/jdk/internal/reflect/Reflection.java
test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
test/jdk/jdk/internal/reflect/Reflection/Filtering.java
--- a/src/java.base/share/classes/jdk/internal/reflect/Reflection.java	Thu Dec 13 13:03:26 2018 +0530
+++ b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java	Thu Dec 13 09:02:52 2018 +0000
@@ -56,6 +56,7 @@
             Constructor.class, ALL_MEMBERS,
             Field.class, ALL_MEMBERS,
             Method.class, ALL_MEMBERS,
+            Module.class, ALL_MEMBERS,
             System.class, Set.of("security")
         );
         methodFilterMap = Map.of();
--- a/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Dec 13 13:03:26 2018 +0530
+++ b/test/hotspot/jtreg/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Dec 13 09:02:52 2018 +0000
@@ -772,7 +772,8 @@
             f.getDeclaringClass().equals(metaAccess.lookupJavaType(AccessibleObject.class)) ||
             f.getDeclaringClass().equals(metaAccess.lookupJavaType(Constructor.class)) ||
             f.getDeclaringClass().equals(metaAccess.lookupJavaType(Field.class)) ||
-            f.getDeclaringClass().equals(metaAccess.lookupJavaType(Method.class))) {
+            f.getDeclaringClass().equals(metaAccess.lookupJavaType(Method.class)) ||
+            f.getDeclaringClass().equals(metaAccess.lookupJavaType(Module.class))) {
             return true;
         }
         return false;
--- a/test/jdk/jdk/internal/reflect/Reflection/Filtering.java	Thu Dec 13 13:03:26 2018 +0530
+++ b/test/jdk/jdk/internal/reflect/Reflection/Filtering.java	Thu Dec 13 09:02:52 2018 +0000
@@ -61,6 +61,8 @@
             { Lookup.class, "allowedModes" },
             { Method.class, "clazz" },
             { Method.class, "modifiers" },
+            { Module.class, "name" },
+            { Module.class, "loader" },
             { System.class, "security" },
         };
     }