changeset 10834:88dd08d7be0f jdk-9+115

8137058: Clear out all non-Critical APIs from sun.reflect Reviewed-by: alanb, jfranck, mchung
author chegar
date Fri, 15 Apr 2016 16:19:15 +0100
parents 1759965f1593
children af495803eaf5 367eb38ebfff 1c9fdb81b25d
files src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/javaClasses.cpp src/share/vm/classfile/javaClasses.hpp src/share/vm/classfile/systemDictionary.hpp src/share/vm/classfile/verifier.cpp src/share/vm/classfile/vmSymbols.hpp src/share/vm/prims/jvm.cpp src/share/vm/runtime/reflection.cpp src/share/vm/runtime/reflectionUtils.cpp test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java
diffstat 23 files changed, 77 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/classFileParser.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -1967,7 +1967,7 @@
                           loader_data->is_platform_class_loader_data() ||
                           loader_data->is_anonymous();
   switch (sid) {
-    case vmSymbols::VM_SYMBOL_ENUM_NAME(sun_reflect_CallerSensitive_signature): {
+    case vmSymbols::VM_SYMBOL_ENUM_NAME(reflect_CallerSensitive_signature): {
       if (_location != _in_method)  break;  // only allow for methods
       if (!privileged)              break;  // only allow in privileged code
       return _method_CallerSensitive;
--- a/src/share/vm/classfile/javaClasses.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/javaClasses.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -2750,7 +2750,7 @@
   field->obj_field_put(type_annotations_offset, value);
 }
 
-void sun_reflect_ConstantPool::compute_offsets() {
+void reflect_ConstantPool::compute_offsets() {
   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
   // This null test can be removed post beta
   if (k != NULL) {
@@ -2894,7 +2894,7 @@
   module->address_field_put(_module_entry_offset, (address)module_entry);
 }
 
-Handle sun_reflect_ConstantPool::create(TRAPS) {
+Handle reflect_ConstantPool::create(TRAPS) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   Klass* k = SystemDictionary::reflect_ConstantPool_klass();
   instanceKlassHandle klass (THREAD, k);
@@ -2904,14 +2904,14 @@
 }
 
 
-void sun_reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
+void reflect_ConstantPool::set_cp(oop reflect, ConstantPool* value) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
   oop mirror = value->pool_holder()->java_mirror();
   // Save the mirror to get back the constant pool.
   reflect->obj_field_put(_oop_offset, mirror);
 }
 
-ConstantPool* sun_reflect_ConstantPool::get_cp(oop reflect) {
+ConstantPool* reflect_ConstantPool::get_cp(oop reflect) {
   assert(Universe::is_fully_initialized(), "Need to find another solution to the reflection problem");
 
   oop mirror = reflect->obj_field(_oop_offset);
@@ -2926,7 +2926,7 @@
   return InstanceKlass::cast(k)->constants();
 }
 
-void sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
+void reflect_UnsafeStaticFieldAccessorImpl::compute_offsets() {
   Klass* k = SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass();
   // This null test can be removed post beta
   if (k != NULL) {
@@ -3706,8 +3706,8 @@
 int java_lang_AssertionStatusDirectives::deflt_offset;
 int java_nio_Buffer::_limit_offset;
 int java_util_concurrent_locks_AbstractOwnableSynchronizer::_owner_offset = 0;
-int sun_reflect_ConstantPool::_oop_offset;
-int sun_reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
+int reflect_ConstantPool::_oop_offset;
+int reflect_UnsafeStaticFieldAccessorImpl::_base_offset;
 
 
 // Support for java_lang_StackTraceElement
@@ -3912,8 +3912,8 @@
   java_lang_reflect_Constructor::compute_offsets();
   java_lang_reflect_Field::compute_offsets();
   java_nio_Buffer::compute_offsets();
-  sun_reflect_ConstantPool::compute_offsets();
-  sun_reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
+  reflect_ConstantPool::compute_offsets();
+  reflect_UnsafeStaticFieldAccessorImpl::compute_offsets();
   java_lang_reflect_Parameter::compute_offsets();
   java_lang_reflect_Module::compute_offsets();
   java_lang_StackFrameInfo::compute_offsets();
--- a/src/share/vm/classfile/javaClasses.hpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/javaClasses.hpp	Fri Apr 15 16:19:15 2016 +0100
@@ -799,8 +799,8 @@
   friend class JavaClasses;
 };
 
-// Interface to sun.reflect.ConstantPool objects
-class sun_reflect_ConstantPool {
+// Interface to jdk.internal.reflect.ConstantPool objects
+class reflect_ConstantPool {
  private:
   // Note that to reduce dependencies on the JDK we compute these
   // offsets at run-time.
@@ -824,8 +824,8 @@
   friend class JavaClasses;
 };
 
-// Interface to sun.reflect.UnsafeStaticFieldAccessorImpl objects
-class sun_reflect_UnsafeStaticFieldAccessorImpl {
+// Interface to jdk.internal.reflect.UnsafeStaticFieldAccessorImpl objects
+class reflect_UnsafeStaticFieldAccessorImpl {
  private:
   static int _base_offset;
   static void compute_offsets();
--- a/src/share/vm/classfile/systemDictionary.hpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/systemDictionary.hpp	Fri Apr 15 16:19:15 2016 +0100
@@ -142,13 +142,13 @@
                                                                                                                          \
   /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */                              \
   /* It's okay if this turns out to be NULL in non-1.4 JDKs. */                                                          \
-  do_klass(reflect_MagicAccessorImpl_klass,             sun_reflect_MagicAccessorImpl,             Opt                 ) \
-  do_klass(reflect_MethodAccessorImpl_klass,            sun_reflect_MethodAccessorImpl,            Pre                 ) \
-  do_klass(reflect_ConstructorAccessorImpl_klass,       sun_reflect_ConstructorAccessorImpl,       Pre                 ) \
-  do_klass(reflect_DelegatingClassLoader_klass,         sun_reflect_DelegatingClassLoader,         Opt                 ) \
-  do_klass(reflect_ConstantPool_klass,                  sun_reflect_ConstantPool,                  Opt                 ) \
-  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, sun_reflect_UnsafeStaticFieldAccessorImpl, Opt                 ) \
-  do_klass(reflect_CallerSensitive_klass,               sun_reflect_CallerSensitive,               Opt                 ) \
+  do_klass(reflect_MagicAccessorImpl_klass,             reflect_MagicAccessorImpl,                 Opt                 ) \
+  do_klass(reflect_MethodAccessorImpl_klass,            reflect_MethodAccessorImpl,                Pre                 ) \
+  do_klass(reflect_ConstructorAccessorImpl_klass,       reflect_ConstructorAccessorImpl,           Pre                 ) \
+  do_klass(reflect_DelegatingClassLoader_klass,         reflect_DelegatingClassLoader,             Opt                 ) \
+  do_klass(reflect_ConstantPool_klass,                  reflect_ConstantPool,                      Opt                 ) \
+  do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl,     Opt                 ) \
+  do_klass(reflect_CallerSensitive_klass,               reflect_CallerSensitive,                   Opt                 ) \
                                                                                                                          \
   /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */                                            \
   do_klass(DirectMethodHandle_klass,                    java_lang_invoke_DirectMethodHandle,       Opt                 ) \
--- a/src/share/vm/classfile/verifier.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/verifier.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -248,7 +248,7 @@
     // As of the fix for 4486457 we disable verification for all of the
     // dynamically-generated bytecodes associated with the 1.4
     // reflection implementation, not just those associated with
-    // sun/reflect/SerializationConstructorAccessor.
+    // jdk/internal/reflect/SerializationConstructorAccessor.
     // NOTE: this is called too early in the bootstrapping process to be
     // guarded by Universe::is_gte_jdk14x_version().
     // Also for lambda generated code, gte jdk8
--- a/src/share/vm/classfile/vmSymbols.hpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/classfile/vmSymbols.hpp	Fri Apr 15 16:19:15 2016 +0100
@@ -227,26 +227,20 @@
                                                                                                   \
   /* Support for reflection based on dynamic bytecode generation (JDK 1.4 and above) */           \
                                                                                                   \
-  template(sun_reflect_FieldInfo,                     "sun/reflect/FieldInfo")                    \
-  template(sun_reflect_MethodInfo,                    "sun/reflect/MethodInfo")                   \
-  template(sun_reflect_MagicAccessorImpl,             "sun/reflect/MagicAccessorImpl")            \
-  template(sun_reflect_MethodAccessorImpl,            "sun/reflect/MethodAccessorImpl")           \
-  template(sun_reflect_ConstructorAccessorImpl,       "sun/reflect/ConstructorAccessorImpl")      \
-  template(sun_reflect_SerializationConstructorAccessorImpl, "sun/reflect/SerializationConstructorAccessorImpl") \
-  template(sun_reflect_DelegatingClassLoader,         "sun/reflect/DelegatingClassLoader")        \
-  template(sun_reflect_Reflection,                    "sun/reflect/Reflection")                   \
-  template(sun_reflect_CallerSensitive,               "sun/reflect/CallerSensitive")              \
-  template(sun_reflect_CallerSensitive_signature,     "Lsun/reflect/CallerSensitive;")            \
+  template(reflect_MagicAccessorImpl,                 "jdk/internal/reflect/MagicAccessorImpl")       \
+  template(reflect_MethodAccessorImpl,                "jdk/internal/reflect/MethodAccessorImpl")      \
+  template(reflect_ConstructorAccessorImpl,           "jdk/internal/reflect/ConstructorAccessorImpl") \
+  template(reflect_DelegatingClassLoader,             "jdk/internal/reflect/DelegatingClassLoader")   \
+  template(reflect_Reflection,                        "jdk/internal/reflect/Reflection")              \
+  template(reflect_CallerSensitive,                   "jdk/internal/reflect/CallerSensitive")         \
+  template(reflect_CallerSensitive_signature,         "Ljdk/internal/reflect/CallerSensitive;")       \
   template(checkedExceptions_name,                    "checkedExceptions")                        \
   template(clazz_name,                                "clazz")                                    \
   template(exceptionTypes_name,                       "exceptionTypes")                           \
   template(modifiers_name,                            "modifiers")                                \
   template(newConstructor_name,                       "newConstructor")                           \
-  template(newConstructor_signature,                  "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Constructor;") \
   template(newField_name,                             "newField")                                 \
-  template(newField_signature,                        "(Lsun/reflect/FieldInfo;)Ljava/lang/reflect/Field;") \
   template(newMethod_name,                            "newMethod")                                \
-  template(newMethod_signature,                       "(Lsun/reflect/MethodInfo;)Ljava/lang/reflect/Method;") \
   template(invokeBasic_name,                          "invokeBasic")                              \
   template(linkToVirtual_name,                        "linkToVirtual")                            \
   template(linkToStatic_name,                         "linkToStatic")                             \
@@ -268,9 +262,9 @@
   template(executable_name,                           "executable")                               \
   template(parameter_annotations_name,                "parameterAnnotations")                     \
   template(annotation_default_name,                   "annotationDefault")                        \
-  template(sun_reflect_ConstantPool,                  "sun/reflect/ConstantPool")                 \
+  template(reflect_ConstantPool,                      "jdk/internal/reflect/ConstantPool")        \
   template(ConstantPool_name,                         "constantPoolOop")                          \
-  template(sun_reflect_UnsafeStaticFieldAccessorImpl, "sun/reflect/UnsafeStaticFieldAccessorImpl")\
+  template(reflect_UnsafeStaticFieldAccessorImpl,     "jdk/internal/reflect/UnsafeStaticFieldAccessorImpl")\
   template(base_name,                                 "base")                                     \
   /* Type Annotations (JDK 8 and above) */                                                        \
   template(type_annotations_name,                     "typeAnnotations")                          \
@@ -870,12 +864,12 @@
   do_intrinsic(_Class_cast,               java_lang_Class,        Class_cast_name, object_object_signature,      F_R)   \
    do_name(     Class_cast_name,                                 "cast")                                                \
                                                                                                                         \
-  do_intrinsic(_getClassAccessFlags,      sun_reflect_Reflection, getClassAccessFlags_name, class_int_signature, F_SN)  \
+  do_intrinsic(_getClassAccessFlags,      reflect_Reflection,     getClassAccessFlags_name, class_int_signature, F_SN)  \
    do_name(     getClassAccessFlags_name,                        "getClassAccessFlags")                                 \
   do_intrinsic(_getLength,                java_lang_reflect_Array, getLength_name, object_int_signature,         F_SN)  \
    do_name(     getLength_name,                                   "getLength")                                          \
                                                                                                                         \
-  do_intrinsic(_getCallerClass,           sun_reflect_Reflection, getCallerClass_name, void_class_signature,     F_SN)  \
+  do_intrinsic(_getCallerClass,           reflect_Reflection,     getCallerClass_name, void_class_signature,     F_SN)  \
    do_name(     getCallerClass_name,                             "getCallerClass")                                      \
                                                                                                                         \
   do_intrinsic(_newArray,                 java_lang_reflect_Array, newArray_name, newArray_signature,            F_SN)  \
--- a/src/share/vm/prims/jvm.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/prims/jvm.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -1983,8 +1983,8 @@
     Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve_non_null(cls));
     if (k->is_instance_klass()) {
       instanceKlassHandle k_h(THREAD, k);
-      Handle jcp = sun_reflect_ConstantPool::create(CHECK_NULL);
-      sun_reflect_ConstantPool::set_cp(jcp(), k_h->constants());
+      Handle jcp = reflect_ConstantPool::create(CHECK_NULL);
+      reflect_ConstantPool::set_cp(jcp(), k_h->constants());
       return JNIHandles::make_local(jcp());
     }
   }
@@ -1996,7 +1996,7 @@
 JVM_ENTRY(jint, JVM_ConstantPoolGetSize(JNIEnv *env, jobject obj, jobject unused))
 {
   JVMWrapper("JVM_ConstantPoolGetSize");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   return cp->length();
 }
 JVM_END
@@ -2005,7 +2005,7 @@
 JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetClassAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_klass() && !tag.is_unresolved_klass()) {
@@ -2019,7 +2019,7 @@
 JVM_ENTRY(jclass, JVM_ConstantPoolGetClassAtIfLoaded(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetClassAtIfLoaded");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_klass() && !tag.is_unresolved_klass()) {
@@ -2064,7 +2064,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetMethodAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   jobject res = get_method_at_helper(cp, index, true, CHECK_NULL);
   return res;
@@ -2075,7 +2075,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetMethodAtIfLoaded");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   jobject res = get_method_at_helper(cp, index, false, CHECK_NULL);
   return res;
@@ -2111,7 +2111,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetFieldAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   jobject res = get_field_at_helper(cp, index, true, CHECK_NULL);
   return res;
@@ -2122,7 +2122,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetFieldAtIfLoaded");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   jobject res = get_field_at_helper(cp, index, false, CHECK_NULL);
   return res;
@@ -2133,7 +2133,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetMemberRefInfoAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_field_or_method()) {
@@ -2159,7 +2159,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetClassRefIndexAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_0);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_field_or_method()) {
@@ -2173,7 +2173,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetNameAndTypeRefIndexAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_0);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_invoke_dynamic() && !tag.is_field_or_method()) {
@@ -2187,7 +2187,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetNameAndTypeRefInfoAt");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_name_and_type()) {
@@ -2208,7 +2208,7 @@
 JVM_ENTRY(jint, JVM_ConstantPoolGetIntAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetIntAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_0);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_int()) {
@@ -2221,7 +2221,7 @@
 JVM_ENTRY(jlong, JVM_ConstantPoolGetLongAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetLongAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_(0L));
   constantTag tag = cp->tag_at(index);
   if (!tag.is_long()) {
@@ -2234,7 +2234,7 @@
 JVM_ENTRY(jfloat, JVM_ConstantPoolGetFloatAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetFloatAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_(0.0f));
   constantTag tag = cp->tag_at(index);
   if (!tag.is_float()) {
@@ -2247,7 +2247,7 @@
 JVM_ENTRY(jdouble, JVM_ConstantPoolGetDoubleAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetDoubleAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_(0.0));
   constantTag tag = cp->tag_at(index);
   if (!tag.is_double()) {
@@ -2260,7 +2260,7 @@
 JVM_ENTRY(jstring, JVM_ConstantPoolGetStringAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetStringAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_string()) {
@@ -2275,7 +2275,7 @@
 {
   JVMWrapper("JVM_ConstantPoolGetUTF8At");
   JvmtiVMObjectAllocEventCollector oam;
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
   if (!tag.is_symbol()) {
@@ -2290,7 +2290,7 @@
 JVM_ENTRY(jbyte, JVM_ConstantPoolGetTagAt(JNIEnv *env, jobject obj, jobject unused, jint index))
 {
   JVMWrapper("JVM_ConstantPoolGetTagAt");
-  constantPoolHandle cp = constantPoolHandle(THREAD, sun_reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
+  constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_0);
   constantTag tag = cp->tag_at(index);
   jbyte result = tag.value();
--- a/src/share/vm/runtime/reflection.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/runtime/reflection.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -487,7 +487,7 @@
       is_same_class_package(current_class, new_class)) {
     return ACCESS_OK;
   }
-  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
   // succeed trivially.
   if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return ACCESS_OK;
@@ -698,7 +698,7 @@
     return true;
   }
 
-  // Allow all accesses from sun/reflect/MagicAccessorImpl subclasses to
+  // Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
   // succeed trivially.
   if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
     return true;
--- a/src/share/vm/runtime/reflectionUtils.cpp	Thu Apr 14 09:33:16 2016 -0700
+++ b/src/share/vm/runtime/reflectionUtils.cpp	Fri Apr 15 16:19:15 2016 +0100
@@ -76,9 +76,9 @@
   int offset;
   offset = java_lang_Throwable::get_backtrace_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::Throwable_klass(), offset));
-  offset = sun_reflect_ConstantPool::oop_offset();
+  offset = reflect_ConstantPool::oop_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::reflect_ConstantPool_klass(), offset));
-  offset = sun_reflect_UnsafeStaticFieldAccessorImpl::base_offset();
+  offset = reflect_UnsafeStaticFieldAccessorImpl::base_offset();
   _filtered_fields->append(new FilteredField(SystemDictionary::reflect_UnsafeStaticFieldAccessorImpl_klass(), offset));
 }
 
--- a/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ConstantPoolTestCase.java	Fri Apr 15 16:19:15 2016 +0100
@@ -28,8 +28,8 @@
 import java.util.Map;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import sun.hotspot.WhiteBox;
-import sun.reflect.ConstantPool;
-import sun.reflect.ConstantPool.Tag;
+import jdk.internal.reflect.ConstantPool;
+import jdk.internal.reflect.ConstantPool.Tag;
 import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses;
 import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.*;
 
--- a/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ConstantPoolTestsHelper.java	Fri Apr 15 16:19:15 2016 +0100
@@ -34,8 +34,8 @@
 import jdk.internal.misc.SharedSecrets;
 import jdk.internal.org.objectweb.asm.Opcodes;
 import sun.hotspot.WhiteBox;
-import sun.reflect.ConstantPool;
-import sun.reflect.ConstantPool.Tag;
+import jdk.internal.reflect.ConstantPool;
+import jdk.internal.reflect.ConstantPool.Tag;
 
 /**
  * Class contains hard-coded constant pool tables for dummy classes used for
--- a/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupKlassInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -30,6 +30,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupKlassRefIndexInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupMethodInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupNameAndTypeRefIndexInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupNameInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/LookupSignatureInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/MethodIsIgnoredBySecurityStackWalkTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -28,7 +28,8 @@
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
  * @library /testlibrary /test/lib /
  * @library ../common/patches
- * @modules java.base/jdk.internal.org.objectweb.asm
+ * @modules java.base/jdk.internal.reflect
+ *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.code
@@ -76,7 +77,7 @@
             testCases.put(aClass.getMethod("invoke", Object.class,
                     Object[].class), true);
 
-            aClass = Class.forName("sun.reflect.NativeMethodAccessorImpl");
+            aClass = Class.forName("jdk.internal.reflect.NativeMethodAccessorImpl");
             testCases.put(aClass.getMethod("invoke", Object.class,
                     Object[].class), true);
             testCases.put(aClass.getDeclaredMethod("invoke0", Method.class,
--- a/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ResolveConstantInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ResolveFieldInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ResolvePossiblyCachedConstantInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -29,6 +29,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          java.base/jdk.internal.org.objectweb.asm.tree
  *          jdk.vm.ci/jdk.vm.ci.hotspot
--- a/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/compilerToVM/ResolveTypeInPoolTest.java	Fri Apr 15 16:19:15 2016 +0100
@@ -30,6 +30,7 @@
  * @library /testlibrary /test/lib /
  * @library ../common/patches
  * @modules java.base/jdk.internal.misc
+ *          java.base/jdk.internal.reflect
  *          java.base/jdk.internal.org.objectweb.asm
  *          jdk.vm.ci/jdk.vm.ci.hotspot
  *          jdk.vm.ci/jdk.vm.ci.meta
--- a/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Thu Apr 14 09:33:16 2016 -0700
+++ b/test/compiler/jvmci/jdk.vm.ci.runtime.test/src/jdk/vm/ci/runtime/test/TestResolvedJavaType.java	Fri Apr 15 16:19:15 2016 +0100
@@ -25,7 +25,8 @@
  * @test
  * @requires (os.simpleArch == "x64" | os.simpleArch == "sparcv9" | os.simpleArch == "aarch64")
  * @library ../../../../../
- * @modules jdk.vm.ci/jdk.vm.ci.meta
+ * @modules java.base/jdk.internal.reflect
+ *          jdk.vm.ci/jdk.vm.ci.meta
  *          jdk.vm.ci/jdk.vm.ci.runtime
  *          jdk.vm.ci/jdk.vm.ci.common
  * @build jdk.vm.ci.runtime.test.TestResolvedJavaType
@@ -70,7 +71,7 @@
 
 import org.junit.Test;
 
-import sun.reflect.ConstantPool;
+import jdk.internal.reflect.ConstantPool;
 
 /**
  * Tests for {@link ResolvedJavaType}.