From 07cdc33e34939a92da80110a1038ae0e233b1081 Mon Sep 17 00:00:00 2001 From: Chris Hegarty Date: Fri, 15 Apr 2016 16:19:15 +0100 Subject: [PATCH] 8137058: Clear out all non-Critical APIs from sun.reflect Reviewed-by: alanb, jfranck, mchung --- jdk/make/mapfiles/libjava/mapfile-vers | 46 ++++----- .../classes/java/io/ObjectStreamClass.java | 6 +- .../classes/java/io/ObjectStreamField.java | 4 +- .../share/classes/java/lang/Class.java | 10 +- .../share/classes/java/lang/ClassLoader.java | 4 +- .../share/classes/java/lang/Package.java | 4 +- .../share/classes/java/lang/Runtime.java | 4 +- .../classes/java/lang/SecurityManager.java | 2 +- .../classes/java/lang/StackStreamFactory.java | 9 +- .../share/classes/java/lang/StackWalker.java | 2 +- .../share/classes/java/lang/System.java | 6 +- .../share/classes/java/lang/Thread.java | 4 +- .../java/lang/invoke/MethodHandleImpl.java | 4 +- .../java/lang/invoke/MethodHandleProxies.java | 4 +- .../java/lang/invoke/MethodHandles.java | 4 +- .../java/lang/reflect/AccessibleObject.java | 8 +- .../java/lang/reflect/Constructor.java | 6 +- .../classes/java/lang/reflect/Field.java | 6 +- .../classes/java/lang/reflect/Method.java | 6 +- .../classes/java/lang/reflect/Modifier.java | 7 +- .../classes/java/lang/reflect/Module.java | 4 +- .../classes/java/lang/reflect/Proxy.java | 4 +- .../java/lang/reflect/ReflectAccess.java | 6 +- .../share/classes/java/net/InetAddress.java | 22 ++--- .../java/security/AccessController.java | 4 +- .../classes/java/util/ResourceBundle.java | 4 +- .../classes/java/util/ServiceLoader.java | 4 +- .../atomic/AtomicIntegerFieldUpdater.java | 4 +- .../atomic/AtomicLongFieldUpdater.java | 4 +- .../atomic/AtomicReferenceFieldUpdater.java | 4 +- .../jdk/internal/misc/JavaLangAccess.java | 2 +- .../classes/jdk/internal/misc/Unsafe.java | 6 +- .../internal}/reflect/AccessorGenerator.java | 2 +- .../BootstrapConstructorAccessorImpl.java | 2 +- .../internal}/reflect/ByteVector.java | 2 +- .../internal}/reflect/ByteVectorFactory.java | 2 +- .../internal}/reflect/ByteVectorImpl.java | 2 +- .../internal}/reflect/CallerSensitive.java | 4 +- .../internal}/reflect/ClassDefiner.java | 2 +- .../internal}/reflect/ClassFileAssembler.java | 2 +- .../internal}/reflect/ClassFileConstants.java | 2 +- .../internal}/reflect/ConstantPool.java | 2 +- .../reflect/ConstructorAccessor.java | 2 +- .../reflect/ConstructorAccessorImpl.java | 2 +- .../DelegatingConstructorAccessorImpl.java | 2 +- .../reflect/DelegatingMethodAccessorImpl.java | 2 +- .../internal}/reflect/FieldAccessor.java | 2 +- .../internal}/reflect/FieldAccessorImpl.java | 2 +- ...ationExceptionConstructorAccessorImpl.java | 2 +- .../{sun => jdk/internal}/reflect/Label.java | 2 +- .../internal}/reflect/LangReflectAccess.java | 2 +- .../internal}/reflect/MagicAccessorImpl.java | 2 +- .../internal}/reflect/MethodAccessor.java | 2 +- .../reflect/MethodAccessorGenerator.java | 16 ++-- .../internal}/reflect/MethodAccessorImpl.java | 2 +- .../NativeConstructorAccessorImpl.java | 2 +- .../reflect/NativeMethodAccessorImpl.java | 2 +- .../internal}/reflect/Reflection.java | 10 +- .../internal}/reflect/ReflectionFactory.java | 2 +- .../SerializationConstructorAccessorImpl.java | 2 +- .../internal}/reflect/SignatureIterator.java | 4 +- .../{sun => jdk/internal}/reflect/UTF8.java | 2 +- .../UnsafeBooleanFieldAccessorImpl.java | 2 +- .../reflect/UnsafeByteFieldAccessorImpl.java | 2 +- .../UnsafeCharacterFieldAccessorImpl.java | 2 +- .../UnsafeDoubleFieldAccessorImpl.java | 2 +- .../reflect/UnsafeFieldAccessorFactory.java | 2 +- .../reflect/UnsafeFieldAccessorImpl.java | 2 +- .../reflect/UnsafeFloatFieldAccessorImpl.java | 2 +- .../UnsafeIntegerFieldAccessorImpl.java | 2 +- .../reflect/UnsafeLongFieldAccessorImpl.java | 2 +- .../UnsafeObjectFieldAccessorImpl.java | 2 +- ...safeQualifiedBooleanFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedByteFieldAccessorImpl.java | 2 +- ...feQualifiedCharacterFieldAccessorImpl.java | 2 +- ...nsafeQualifiedDoubleFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedFieldAccessorImpl.java | 2 +- ...UnsafeQualifiedFloatFieldAccessorImpl.java | 2 +- ...safeQualifiedIntegerFieldAccessorImpl.java | 2 +- .../UnsafeQualifiedLongFieldAccessorImpl.java | 2 +- ...nsafeQualifiedObjectFieldAccessorImpl.java | 2 +- ...UnsafeQualifiedShortFieldAccessorImpl.java | 2 +- ...alifiedStaticBooleanFieldAccessorImpl.java | 2 +- ...eQualifiedStaticByteFieldAccessorImpl.java | 2 +- ...ifiedStaticCharacterFieldAccessorImpl.java | 2 +- ...ualifiedStaticDoubleFieldAccessorImpl.java | 2 +- ...nsafeQualifiedStaticFieldAccessorImpl.java | 2 +- ...QualifiedStaticFloatFieldAccessorImpl.java | 2 +- ...alifiedStaticIntegerFieldAccessorImpl.java | 2 +- ...eQualifiedStaticLongFieldAccessorImpl.java | 2 +- ...ualifiedStaticObjectFieldAccessorImpl.java | 2 +- ...QualifiedStaticShortFieldAccessorImpl.java | 2 +- .../reflect/UnsafeShortFieldAccessorImpl.java | 2 +- .../UnsafeStaticBooleanFieldAccessorImpl.java | 2 +- .../UnsafeStaticByteFieldAccessorImpl.java | 2 +- ...nsafeStaticCharacterFieldAccessorImpl.java | 2 +- .../UnsafeStaticDoubleFieldAccessorImpl.java | 2 +- .../UnsafeStaticFieldAccessorImpl.java | 2 +- .../UnsafeStaticFloatFieldAccessorImpl.java | 2 +- .../UnsafeStaticIntegerFieldAccessorImpl.java | 2 +- .../UnsafeStaticLongFieldAccessorImpl.java | 2 +- .../UnsafeStaticObjectFieldAccessorImpl.java | 2 +- .../UnsafeStaticShortFieldAccessorImpl.java | 2 +- .../java.base/share/classes/module-info.java | 11 ++- .../classes/sun/invoke/util/VerifyAccess.java | 2 +- .../share/classes/sun/reflect/FieldInfo.java | 71 -------------- .../reflect/annotation/AnnotationParser.java | 2 +- .../reflect/annotation/AnnotationSupport.java | 2 +- .../annotation/TypeAnnotationParser.java | 2 +- .../classes/sun/reflect/misc/ReflectUtil.java | 2 +- .../java.base/share/native/libjava/Class.c | 2 +- .../share/native/libjava/ConstantPool.c | 38 ++++---- .../share/native/libjava/NativeAccessors.c | 8 +- .../share/native/libjava/Reflection.c | 8 +- .../classes/java/util/logging/Logger.java | 4 +- .../sql/rowset/serial/SerialJavaObject.java | 6 +- .../share/classes/java/sql/DriverManager.java | 4 +- .../share/classes/module-info.java | 2 +- .../share/classes/sun/misc/Unsafe.java | 6 +- .../share/classes/sun/reflect/Reflection.java | 45 +++++++++ .../sun/reflect/ReflectionFactory.java | 83 ++++++++++++++++ jdk/test/TEST.groups | 5 +- .../java/lang/StackWalker/DumpStackTest.java | 30 +++--- .../StackWalker/EmbeddedStackWalkTest.java | 4 +- .../java/lang/StackWalker/HiddenFrames.java | 2 +- .../StackWalker/MultiThreadStackWalk.java | 4 +- .../java/lang/StackWalker/StackWalkTest.java | 4 +- .../lang/StackWalker/VerifyStackTrace.java | 12 +-- .../java/lang/invoke/RevealDirectTest.java | 6 +- .../ManyNewInstanceAnonTest.java | 0 .../CallerSensitiveFinder.java | 12 ++- .../MissingCallerSensitive.java | 10 +- .../reflect/Reflection/GetCallerClass.java | 6 +- .../Reflection/GetCallerClassTest.java | 6 +- .../reflect/Reflection/GetCallerClassTest.sh | 6 +- .../Reflection/GetCallerClassWithDepth.java | 95 +++++++++++++++++++ .../constantPool/ConstantPoolTest.java | 10 +- .../constantPool/ConstantPoolTestDummy.jasm | 6 +- .../Reflection/GetCallerClassWithDepth.java | 19 ++-- .../NewConstructorForSerialization.java | 61 ++++++++++++ .../modules/addexports/AddExportsTest.java | 6 +- 141 files changed, 604 insertions(+), 380 deletions(-) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/AccessorGenerator.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/BootstrapConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ByteVector.java (97%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ByteVectorFactory.java (97%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ByteVectorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/CallerSensitive.java (92%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ClassDefiner.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ClassFileAssembler.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ClassFileConstants.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ConstantPool.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ConstructorAccessor.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/DelegatingConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/DelegatingMethodAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/FieldAccessor.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/FieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/InstantiationExceptionConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/Label.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/LangReflectAccess.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/MagicAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/MethodAccessor.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/MethodAccessorGenerator.java (97%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/MethodAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/NativeConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/NativeMethodAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/Reflection.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/ReflectionFactory.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/SerializationConstructorAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/SignatureIterator.java (97%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UTF8.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeBooleanFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeByteFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeCharacterFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeDoubleFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeFieldAccessorFactory.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeFloatFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeIntegerFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeLongFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeObjectFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedByteFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedFieldAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedLongFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedShortFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeShortFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticBooleanFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticByteFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticCharacterFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticDoubleFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticFieldAccessorImpl.java (98%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticFloatFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticIntegerFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticLongFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticObjectFieldAccessorImpl.java (99%) rename jdk/src/java.base/share/classes/{sun => jdk/internal}/reflect/UnsafeStaticShortFieldAccessorImpl.java (99%) delete mode 100644 jdk/src/java.base/share/classes/sun/reflect/FieldInfo.java create mode 100644 jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java create mode 100644 jdk/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java rename jdk/test/{sun => jdk/internal}/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java (100%) rename jdk/test/{sun => jdk/internal}/reflect/CallerSensitive/CallerSensitiveFinder.java (94%) rename jdk/test/{sun => jdk/internal}/reflect/CallerSensitive/MissingCallerSensitive.java (90%) rename jdk/test/{sun => jdk/internal}/reflect/Reflection/GetCallerClass.java (87%) rename jdk/test/{sun => jdk/internal}/reflect/Reflection/GetCallerClassTest.java (96%) rename jdk/test/{sun => jdk/internal}/reflect/Reflection/GetCallerClassTest.sh (90%) create mode 100644 jdk/test/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java rename jdk/test/{sun => jdk/internal}/reflect/constantPool/ConstantPoolTest.java (96%) rename jdk/test/{sun => jdk/internal}/reflect/constantPool/ConstantPoolTestDummy.jasm (95%) create mode 100644 jdk/test/sun/reflect/ReflectionFactory/NewConstructorForSerialization.java diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers index eb35a623fb2..45ca0da9630 100644 --- a/jdk/make/mapfiles/libjava/mapfile-vers +++ b/jdk/make/mapfiles/libjava/mapfile-vers @@ -237,32 +237,32 @@ SUNWprivate_1.1 { Java_jdk_internal_misc_Signal_findSignal0; Java_jdk_internal_misc_Signal_handle0; Java_jdk_internal_misc_Signal_raise0; - Java_sun_reflect_ConstantPool_getClassAt0; - Java_sun_reflect_ConstantPool_getClassAtIfLoaded0; - Java_sun_reflect_ConstantPool_getClassRefIndexAt0; - Java_sun_reflect_ConstantPool_getDoubleAt0; - Java_sun_reflect_ConstantPool_getFieldAt0; - Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0; - Java_sun_reflect_ConstantPool_getFloatAt0; - Java_sun_reflect_ConstantPool_getIntAt0; - Java_sun_reflect_ConstantPool_getLongAt0; - Java_sun_reflect_ConstantPool_getMemberRefInfoAt0; - Java_sun_reflect_ConstantPool_getMethodAt0; - Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0; - Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0; - Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0; - Java_sun_reflect_ConstantPool_getSize0; - Java_sun_reflect_ConstantPool_getStringAt0; - Java_sun_reflect_ConstantPool_getTagAt0; - Java_sun_reflect_ConstantPool_getUTF8At0; + Java_jdk_internal_reflect_ConstantPool_getClassAt0; + Java_jdk_internal_reflect_ConstantPool_getClassAtIfLoaded0; + Java_jdk_internal_reflect_ConstantPool_getClassRefIndexAt0; + Java_jdk_internal_reflect_ConstantPool_getDoubleAt0; + Java_jdk_internal_reflect_ConstantPool_getFieldAt0; + Java_jdk_internal_reflect_ConstantPool_getFieldAtIfLoaded0; + Java_jdk_internal_reflect_ConstantPool_getFloatAt0; + Java_jdk_internal_reflect_ConstantPool_getIntAt0; + Java_jdk_internal_reflect_ConstantPool_getLongAt0; + Java_jdk_internal_reflect_ConstantPool_getMemberRefInfoAt0; + Java_jdk_internal_reflect_ConstantPool_getMethodAt0; + Java_jdk_internal_reflect_ConstantPool_getMethodAtIfLoaded0; + Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefIndexAt0; + Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefInfoAt0; + Java_jdk_internal_reflect_ConstantPool_getSize0; + Java_jdk_internal_reflect_ConstantPool_getStringAt0; + Java_jdk_internal_reflect_ConstantPool_getTagAt0; + Java_jdk_internal_reflect_ConstantPool_getUTF8At0; Java_java_io_Console_istty; Java_java_io_Console_encoding; Java_java_io_Console_echo; - Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0; - Java_sun_reflect_NativeMethodAccessorImpl_invoke0; - Java_sun_reflect_Reflection_getCallerClass__; - Java_sun_reflect_Reflection_getCallerClass__I; - Java_sun_reflect_Reflection_getClassAccessFlags; + Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0; + Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0; + Java_jdk_internal_reflect_Reflection_getCallerClass__; + Java_jdk_internal_reflect_Reflection_getCallerClass__I; + Java_jdk_internal_reflect_Reflection_getClassAccessFlags; Java_jdk_internal_misc_VM_latestUserDefinedLoader; Java_jdk_internal_misc_VM_getuid; Java_jdk_internal_misc_VM_geteuid; diff --git a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java index 5179cce2dbe..cca42a71bbf 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java @@ -49,9 +49,9 @@ import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import jdk.internal.misc.Unsafe; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; -import sun.reflect.ReflectionFactory; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; +import jdk.internal.reflect.ReflectionFactory; import sun.reflect.misc.ReflectUtil; import static java.io.ObjectStreamField.*; diff --git a/jdk/src/java.base/share/classes/java/io/ObjectStreamField.java b/jdk/src/java.base/share/classes/java/io/ObjectStreamField.java index bf03a67d317..3e5c6aa92aa 100644 --- a/jdk/src/java.base/share/classes/java/io/ObjectStreamField.java +++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamField.java @@ -26,8 +26,8 @@ package java.io; import java.lang.reflect.Field; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; /** diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java index fa6971dabfa..3ea9467a45f 100644 --- a/jdk/src/java.base/share/classes/java/lang/Class.java +++ b/jdk/src/java.base/share/classes/java/lang/Class.java @@ -66,10 +66,10 @@ import jdk.internal.loader.BootLoader; import jdk.internal.loader.BuiltinClassLoader; import jdk.internal.misc.Unsafe; import jdk.internal.misc.VM; -import sun.reflect.CallerSensitive; -import sun.reflect.ConstantPool; -import sun.reflect.Reflection; -import sun.reflect.ReflectionFactory; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.ConstantPool; +import jdk.internal.reflect.Reflection; +import jdk.internal.reflect.ReflectionFactory; import sun.reflect.generics.factory.CoreReflectionFactory; import sun.reflect.generics.factory.GenericsFactory; import sun.reflect.generics.repository.ClassRepository; @@ -3473,7 +3473,7 @@ public final class Class implements java.io.Serializable, if (reflectionFactory == null) { reflectionFactory = java.security.AccessController.doPrivileged - (new sun.reflect.ReflectionFactory.GetReflectionFactoryAction()); + (new ReflectionFactory.GetReflectionFactoryAction()); } return reflectionFactory; } diff --git a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java index 9fe76558c82..33e5105bb3d 100644 --- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java +++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java @@ -60,8 +60,8 @@ import jdk.internal.loader.ClassLoaders; import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.Unsafe; import jdk.internal.misc.VM; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; diff --git a/jdk/src/java.base/share/classes/java/lang/Package.java b/jdk/src/java.base/share/classes/java/lang/Package.java index 5b80278b097..3b328ca199f 100644 --- a/jdk/src/java.base/share/classes/java/lang/Package.java +++ b/jdk/src/java.base/share/classes/java/lang/Package.java @@ -36,8 +36,8 @@ import java.security.PrivilegedAction; import java.util.Objects; import jdk.internal.loader.BootLoader; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** diff --git a/jdk/src/java.base/share/classes/java/lang/Runtime.java b/jdk/src/java.base/share/classes/java/lang/Runtime.java index 668357e7067..64b22de4bd6 100644 --- a/jdk/src/java.base/share/classes/java/lang/Runtime.java +++ b/jdk/src/java.base/share/classes/java/lang/Runtime.java @@ -27,8 +27,8 @@ package java.lang; import java.io.*; import java.util.StringTokenizer; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** * Every Java application has a single instance of class diff --git a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java index 4560219fe8e..8ea8f09d103 100644 --- a/jdk/src/java.base/share/classes/java/lang/SecurityManager.java +++ b/jdk/src/java.base/share/classes/java/lang/SecurityManager.java @@ -38,7 +38,7 @@ import java.net.InetAddress; import java.lang.reflect.*; import java.net.URL; -import sun.reflect.CallerSensitive; +import jdk.internal.reflect.CallerSensitive; import sun.security.util.SecurityConstants; /** diff --git a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java index dcb471c4cc2..2c59b5b60fd 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java +++ b/jdk/src/java.base/share/classes/java/lang/StackStreamFactory.java @@ -25,6 +25,7 @@ package java.lang; import jdk.internal.misc.VM; +import jdk.internal.reflect.MethodAccessor; import java.io.PrintStream; import java.lang.StackWalker.Option; @@ -1081,13 +1082,13 @@ final class StackStreamFactory { } private static boolean isReflectionFrame(Class c) { - if (c.getName().startsWith("sun.reflect") && - !sun.reflect.MethodAccessor.class.isAssignableFrom(c)) { - throw new InternalError("Not sun.reflect.MethodAccessor: " + c.toString()); + if (c.getName().startsWith("jdk.internal.reflect") && + !MethodAccessor.class.isAssignableFrom(c)) { + throw new InternalError("Not jdk.internal.reflect.MethodAccessor: " + c.toString()); } // ## should filter all @Hidden frames? return c == Method.class || - sun.reflect.MethodAccessor.class.isAssignableFrom(c) || + MethodAccessor.class.isAssignableFrom(c) || c.getName().startsWith("java.lang.invoke.LambdaForm"); } diff --git a/jdk/src/java.base/share/classes/java/lang/StackWalker.java b/jdk/src/java.base/share/classes/java/lang/StackWalker.java index 636762e17d4..7eeef016681 100644 --- a/jdk/src/java.base/share/classes/java/lang/StackWalker.java +++ b/jdk/src/java.base/share/classes/java/lang/StackWalker.java @@ -24,7 +24,7 @@ */ package java.lang; -import sun.reflect.CallerSensitive; +import jdk.internal.reflect.CallerSensitive; import java.util.*; import java.util.function.Consumer; diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java index 5bbaff28335..02975912bc0 100644 --- a/jdk/src/java.base/share/classes/java/lang/System.java +++ b/jdk/src/java.base/share/classes/java/lang/System.java @@ -56,8 +56,8 @@ import java.util.Objects; import java.util.ResourceBundle; import java.util.function.Supplier; import sun.nio.ch.Interruptible; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.security.util.SecurityConstants; import sun.reflect.annotation.AnnotationType; import jdk.internal.HotSpotIntrinsicCandidate; @@ -1978,7 +1978,7 @@ public final class System { private static void setJavaLangAccess() { // Allow privileged classes outside of java.lang SharedSecrets.setJavaLangAccess(new JavaLangAccess(){ - public sun.reflect.ConstantPool getConstantPool(Class klass) { + public jdk.internal.reflect.ConstantPool getConstantPool(Class klass) { return klass.getConstantPool(); } public boolean casAnnotationType(Class klass, AnnotationType oldType, AnnotationType newType) { diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java index eb47a05427d..9c275ac1be9 100644 --- a/jdk/src/java.base/share/classes/java/lang/Thread.java +++ b/jdk/src/java.base/share/classes/java/lang/Thread.java @@ -37,8 +37,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.locks.LockSupport; import sun.nio.ch.Interruptible; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.security.util.SecurityConstants; import jdk.internal.HotSpotIntrinsicCandidate; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java index 3f1bb2034a6..a108836ce51 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java @@ -33,13 +33,13 @@ import java.util.Iterator; import java.util.List; import java.util.function.Function; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import jdk.internal.vm.annotation.Stable; import sun.invoke.empty.Empty; import sun.invoke.util.ValueConversions; import sun.invoke.util.VerifyType; import sun.invoke.util.Wrapper; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; import static java.lang.invoke.LambdaForm.*; import static java.lang.invoke.MethodHandleStatics.*; import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java index 18ec5d6894d..09db4f93512 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java @@ -30,8 +30,8 @@ import java.security.AccessController; import java.security.PrivilegedAction; import sun.invoke.WrapperInstance; import java.util.ArrayList; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; import static java.lang.invoke.MethodHandleStatics.*; diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java index dd6c3d0384a..ea688b14815 100644 --- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java +++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java @@ -37,8 +37,8 @@ import java.security.PrivilegedAction; import sun.invoke.util.ValueConversions; import sun.invoke.util.VerifyAccess; import sun.invoke.util.Wrapper; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; import java.lang.invoke.LambdaForm.BasicType; diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java index 5b1545dc73b..9d8e0f35c52 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java @@ -27,9 +27,9 @@ package java.lang.reflect; import java.security.AccessController; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; -import sun.reflect.ReflectionFactory; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; +import jdk.internal.reflect.ReflectionFactory; import java.lang.annotation.Annotation; /** @@ -230,7 +230,7 @@ public class AccessibleObject implements AnnotatedElement { // very early in the bootstrapping process. static final ReflectionFactory reflectionFactory = AccessController.doPrivileged( - new sun.reflect.ReflectionFactory.GetReflectionFactoryAction()); + new ReflectionFactory.GetReflectionFactoryAction()); /** * @throws NullPointerException {@inheritDoc} diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java index 4b38728340e..af5fd1d8482 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Constructor.java @@ -26,9 +26,9 @@ package java.lang.reflect; import jdk.internal.misc.SharedSecrets; -import sun.reflect.CallerSensitive; -import sun.reflect.ConstructorAccessor; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.ConstructorAccessor; +import jdk.internal.reflect.Reflection; import sun.reflect.annotation.TypeAnnotation; import sun.reflect.annotation.TypeAnnotationParser; import sun.reflect.generics.repository.ConstructorRepository; diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java index 062676f64b7..862de42638c 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Field.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Field.java @@ -26,9 +26,9 @@ package java.lang.reflect; import jdk.internal.misc.SharedSecrets; -import sun.reflect.CallerSensitive; -import sun.reflect.FieldAccessor; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.FieldAccessor; +import jdk.internal.reflect.Reflection; import sun.reflect.generics.repository.FieldRepository; import sun.reflect.generics.factory.CoreReflectionFactory; import sun.reflect.generics.factory.GenericsFactory; diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java index 005ed2453b7..6e6fab98389 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Method.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Method.java @@ -27,9 +27,9 @@ package java.lang.reflect; import jdk.internal.HotSpotIntrinsicCandidate; import jdk.internal.misc.SharedSecrets; -import sun.reflect.CallerSensitive; -import sun.reflect.MethodAccessor; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.MethodAccessor; +import jdk.internal.reflect.Reflection; import sun.reflect.generics.repository.MethodRepository; import sun.reflect.generics.factory.CoreReflectionFactory; import sun.reflect.generics.factory.GenericsFactory; diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Modifier.java b/jdk/src/java.base/share/classes/java/lang/reflect/Modifier.java index f84a35166a9..d3875d387c2 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Modifier.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Modifier.java @@ -27,8 +27,8 @@ package java.lang.reflect; import java.security.AccessController; import java.util.StringJoiner; -import sun.reflect.LangReflectAccess; -import sun.reflect.ReflectionFactory; +import jdk.internal.reflect.LangReflectAccess; +import jdk.internal.reflect.ReflectionFactory; /** * The Modifier class provides {@code static} methods and @@ -51,8 +51,7 @@ public class Modifier { * packages */ static { - sun.reflect.ReflectionFactory factory = - AccessController.doPrivileged( + ReflectionFactory factory = AccessController.doPrivileged( new ReflectionFactory.GetReflectionFactoryAction()); factory.setLangReflectAccess(new java.lang.reflect.ReflectAccess()); } diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java b/jdk/src/java.base/share/classes/java/lang/reflect/Module.java index 406e3a38519..5de7394a406 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Module.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Module.java @@ -56,8 +56,8 @@ import jdk.internal.loader.BootLoader; import jdk.internal.misc.JavaLangReflectModuleAccess; import jdk.internal.misc.SharedSecrets; import jdk.internal.module.ServicesCatalog; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.security.util.SecurityConstants; /** diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java index ea281b137e9..12abe79d4ea 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/Proxy.java @@ -47,8 +47,8 @@ import jdk.internal.loader.BootLoader; import jdk.internal.module.Modules; import jdk.internal.misc.Unsafe; import jdk.internal.misc.VM; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; import sun.security.util.SecurityConstants; diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java b/jdk/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java index 5a043930030..2a6abd3d682 100644 --- a/jdk/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java +++ b/jdk/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java @@ -25,14 +25,14 @@ package java.lang.reflect; -import sun.reflect.MethodAccessor; -import sun.reflect.ConstructorAccessor; +import jdk.internal.reflect.MethodAccessor; +import jdk.internal.reflect.ConstructorAccessor; /** Package-private class implementing the sun.reflect.LangReflectAccess interface, allowing the java.lang package to instantiate objects in this package. */ -class ReflectAccess implements sun.reflect.LangReflectAccess { +class ReflectAccess implements jdk.internal.reflect.LangReflectAccess { public Field newField(Class declaringClass, String name, Class type, diff --git a/jdk/src/java.base/share/classes/java/net/InetAddress.java b/jdk/src/java.base/share/classes/java/net/InetAddress.java index d385aac06e5..8e0d46152ff 100644 --- a/jdk/src/java.base/share/classes/java/net/InetAddress.java +++ b/jdk/src/java.base/share/classes/java/net/InetAddress.java @@ -894,19 +894,17 @@ class InetAddress implements java.io.Serializable { */ private static final class PlatformNameService implements NameService { - public InetAddress[] lookupAllHostAddr(String host) - throws UnknownHostException { - - return impl.lookupAllHostAddr(host); - - } - - public String getHostByAddr(byte[] addr) throws UnknownHostException { - - return impl.getHostByAddr(addr); - + public InetAddress[] lookupAllHostAddr(String host) + throws UnknownHostException + { + return impl.lookupAllHostAddr(host); } + public String getHostByAddr(byte[] addr) + throws UnknownHostException + { + return impl.getHostByAddr(addr); + } } /** @@ -991,7 +989,6 @@ class InetAddress implements java.io.Serializable { return host; } - /** *

Lookup a host mapping by name. Retrieve the IP addresses * associated with a host. @@ -1004,7 +1001,6 @@ class InetAddress implements java.io.Serializable { * @throws UnknownHostException * if no IP address for the {@code host} could be found */ - public InetAddress[] lookupAllHostAddr(String host) throws UnknownHostException { String hostEntry; diff --git a/jdk/src/java.base/share/classes/java/security/AccessController.java b/jdk/src/java.base/share/classes/java/security/AccessController.java index 90503d29cf8..b37b476efdd 100644 --- a/jdk/src/java.base/share/classes/java/security/AccessController.java +++ b/jdk/src/java.base/share/classes/java/security/AccessController.java @@ -26,8 +26,8 @@ package java.security; import sun.security.util.Debug; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** *

The AccessController class is used for access control operations diff --git a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java index 80f7738cde3..4ce2b50720a 100644 --- a/jdk/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/jdk/src/java.base/share/classes/java/util/ResourceBundle.java @@ -64,8 +64,8 @@ import java.util.spi.ResourceBundleProvider; import jdk.internal.misc.JavaUtilResourceBundleAccess; import jdk.internal.misc.SharedSecrets; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.util.locale.BaseLocale; import sun.util.locale.LocaleObjectCache; import sun.util.locale.provider.ResourceBundleProviderSupport; diff --git a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java index 8d38e785709..7ccce279357 100644 --- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java +++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java @@ -51,8 +51,8 @@ import jdk.internal.misc.VM; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.ServicesCatalog.ServiceProvider; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java index 09b372dc822..10ee364b5b9 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java @@ -42,8 +42,8 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.function.IntBinaryOperator; import java.util.function.IntUnaryOperator; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java index 8770b2d962a..c3ad0afff21 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java @@ -42,8 +42,8 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.function.LongBinaryOperator; import java.util.function.LongUnaryOperator; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java index b30341f73f9..f6dbbe36479 100644 --- a/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java +++ b/jdk/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java @@ -42,8 +42,8 @@ import java.security.PrivilegedActionException; import java.security.PrivilegedExceptionAction; import java.util.function.BinaryOperator; import java.util.function.UnaryOperator; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** * A reflection-based utility that enables atomic updates to diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java index 7ca99963791..f9699f7fdc1 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java @@ -37,7 +37,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.stream.Stream; import jdk.internal.module.ServicesCatalog; -import sun.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool; import sun.reflect.annotation.AnnotationType; import sun.nio.ch.Interruptible; diff --git a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java index beb64fd5155..735d1b86143 100644 --- a/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java +++ b/jdk/src/java.base/share/classes/jdk/internal/misc/Unsafe.java @@ -28,8 +28,8 @@ package jdk.internal.misc; import java.lang.reflect.Field; import java.security.ProtectionDomain; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import jdk.internal.misc.VM; import jdk.internal.HotSpotIntrinsicCandidate; @@ -58,7 +58,7 @@ public final class Unsafe { private static native void registerNatives(); static { registerNatives(); - sun.reflect.Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); + Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); } private Unsafe() {} diff --git a/jdk/src/java.base/share/classes/sun/reflect/AccessorGenerator.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/AccessorGenerator.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java index 3b06f550f0f..83eb05fd389 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/AccessorGenerator.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; import jdk.internal.misc.Unsafe; diff --git a/jdk/src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/BootstrapConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/BootstrapConstructorAccessorImpl.java index d44fc8904fe..bf42b857fba 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/BootstrapConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Constructor; diff --git a/jdk/src/java.base/share/classes/sun/reflect/ByteVector.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVector.java similarity index 97% rename from jdk/src/java.base/share/classes/sun/reflect/ByteVector.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVector.java index ad28ee3ab20..2a07b072982 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ByteVector.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVector.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** A growable array of bytes. */ diff --git a/jdk/src/java.base/share/classes/sun/reflect/ByteVectorFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorFactory.java similarity index 97% rename from jdk/src/java.base/share/classes/sun/reflect/ByteVectorFactory.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorFactory.java index 64af68dd178..3557bd5c515 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ByteVectorFactory.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorFactory.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; class ByteVectorFactory { static ByteVector create() { diff --git a/jdk/src/java.base/share/classes/sun/reflect/ByteVectorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/ByteVectorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorImpl.java index efa1c8abc2e..b0f9d81f7cf 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ByteVectorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ByteVectorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; class ByteVectorImpl implements ByteVector { private byte[] data; diff --git a/jdk/src/java.base/share/classes/sun/reflect/CallerSensitive.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java similarity index 92% rename from jdk/src/java.base/share/classes/sun/reflect/CallerSensitive.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java index 1822fbe66dd..73853198a0d 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/CallerSensitive.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java @@ -23,14 +23,14 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.annotation.*; import static java.lang.annotation.ElementType.*; /** * A method annotated @CallerSensitive is sensitive to its calling class, - * via {@link sun.reflect.Reflection#getCallerClass Reflection.getCallerClass}, + * via {@link jdk.internal.reflect.Reflection#getCallerClass Reflection.getCallerClass}, * or via some equivalent. * * @author John R. Rose diff --git a/jdk/src/java.base/share/classes/sun/reflect/ClassDefiner.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/ClassDefiner.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java index b4d50095939..8bf8bf9d1d7 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ClassDefiner.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.security.AccessController; import java.security.PrivilegedAction; diff --git a/jdk/src/java.base/share/classes/sun/reflect/ClassFileAssembler.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/ClassFileAssembler.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java index 7f6ceccf6e8..aeef5e62f12 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ClassFileAssembler.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; class ClassFileAssembler implements ClassFileConstants { private ByteVector vec; diff --git a/jdk/src/java.base/share/classes/sun/reflect/ClassFileConstants.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileConstants.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/ClassFileConstants.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileConstants.java index 0bf391a09cb..3562a8d5c72 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ClassFileConstants.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ClassFileConstants.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** Minimal set of class file constants for assembly of field and method accessors. */ diff --git a/jdk/src/java.base/share/classes/sun/reflect/ConstantPool.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstantPool.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/ConstantPool.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ConstantPool.java index b813519bf2c..46d2e48c848 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ConstantPool.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstantPool.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; diff --git a/jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessor.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessor.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessor.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessor.java index 7aac26f81ab..30d8baf634c 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessor.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessor.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessorImpl.java index 9b098312a61..36f73b29cc3 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/DelegatingConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/DelegatingConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingConstructorAccessorImpl.java index 6ee4d5f4d7a..6b0f7f51b13 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/DelegatingConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/DelegatingMethodAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/DelegatingMethodAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java index 115d9aa112b..1acab93eb42 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/DelegatingMethodAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/FieldAccessor.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessor.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/FieldAccessor.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessor.java index 7b974f6caf1..0df292afa60 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/FieldAccessor.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessor.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** This interface provides the declarations for the accessor methods of java.lang.reflect.Field. Each Field object is configured with a diff --git a/jdk/src/java.base/share/classes/sun/reflect/FieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/FieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessorImpl.java index cbfa3c1e853..b5121c860dc 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/FieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/FieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** Package-private implementation of the FieldAccessor interface which has access to all classes and all fields, regardless of diff --git a/jdk/src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/InstantiationExceptionConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/InstantiationExceptionConstructorAccessorImpl.java index 854febe7b3f..7ec7dd32f76 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/InstantiationExceptionConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/Label.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/Label.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/Label.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/Label.java index bac62793bde..eb531530f4a 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/Label.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/Label.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.util.List; import java.util.ArrayList; diff --git a/jdk/src/java.base/share/classes/sun/reflect/LangReflectAccess.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/LangReflectAccess.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java index 4da3bc87169..0fed09ff0c4 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/LangReflectAccess.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; diff --git a/jdk/src/java.base/share/classes/sun/reflect/MagicAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MagicAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/MagicAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/MagicAccessorImpl.java index af1382f6a5e..e464e3b6584 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/MagicAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MagicAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /**

MagicAccessorImpl (named for parity with FieldAccessorImpl and others, not because it actually implements an interface) is a diff --git a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessor.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessor.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/MethodAccessor.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessor.java index b38514aeebb..8ffc0233a96 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessor.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessor.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessorGenerator.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java similarity index 97% rename from jdk/src/java.base/share/classes/sun/reflect/MethodAccessorGenerator.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java index 68e1a7c0c43..8efa2a9d4e6 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessorGenerator.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.security.AccessController; import java.security.PrivilegedAction; @@ -148,7 +148,7 @@ class MethodAccessorGenerator extends AccessorGenerator { // (^ = Only present if generating SerializationConstructorAccessor) // [UTF-8] [This class's name] // [CONSTANT_Class_info] for above - // [UTF-8] "sun/reflect/{MethodAccessorImpl,ConstructorAccessorImpl,SerializationConstructorAccessorImpl}" + // [UTF-8] "jdk/internal/reflect/{MethodAccessorImpl,ConstructorAccessorImpl,SerializationConstructorAccessorImpl}" // [CONSTANT_Class_info] for above // [UTF-8] [Target class's name] // [CONSTANT_Class_info] for above @@ -290,12 +290,12 @@ class MethodAccessorGenerator extends AccessorGenerator { if (isConstructor) { if (forSerialization) { asm.emitConstantPoolUTF8 - ("sun/reflect/SerializationConstructorAccessorImpl"); + ("jdk/internal/reflect/SerializationConstructorAccessorImpl"); } else { - asm.emitConstantPoolUTF8("sun/reflect/ConstructorAccessorImpl"); + asm.emitConstantPoolUTF8("jdk/internal/reflect/ConstructorAccessorImpl"); } } else { - asm.emitConstantPoolUTF8("sun/reflect/MethodAccessorImpl"); + asm.emitConstantPoolUTF8("jdk/internal/reflect/MethodAccessorImpl"); } asm.emitConstantPoolClass(asm.cpi()); superClass = asm.cpi(); @@ -767,14 +767,14 @@ class MethodAccessorGenerator extends AccessorGenerator { if (isConstructor) { if (forSerialization) { int num = ++serializationConstructorSymnum; - return "sun/reflect/GeneratedSerializationConstructorAccessor" + num; + return "jdk/internal/reflect/GeneratedSerializationConstructorAccessor" + num; } else { int num = ++constructorSymnum; - return "sun/reflect/GeneratedConstructorAccessor" + num; + return "jdk/internal/reflect/GeneratedConstructorAccessor" + num; } } else { int num = ++methodSymnum; - return "sun/reflect/GeneratedMethodAccessor" + num; + return "jdk/internal/reflect/GeneratedMethodAccessor" + num; } } } diff --git a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/MethodAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorImpl.java index 14282fb67c5..91a02645f4e 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/MethodAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.InvocationTargetException; diff --git a/jdk/src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java index 171521dd2ae..d0b36399e64 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; import sun.reflect.misc.ReflectUtil; diff --git a/jdk/src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java index a33670fe8ce..403113a6fe2 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; import sun.reflect.misc.ReflectUtil; diff --git a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/Reflection.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java index 084995f268b..88e6a8349ca 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/Reflection.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.*; @@ -66,11 +66,11 @@ public class Reflection { public static native Class getCallerClass(); /** - * @deprecated This method will be removed in JDK 9. - * This method is a private JDK API and retained temporarily for - * existing code to run until a replacement API is defined. + * @deprecated This method will be removed. + * This method is a private JDK API and retained temporarily to + * simplify the implementation of sun.misc.Reflection.getCallerClass. */ - @Deprecated + @Deprecated(forRemoval=true) public static native Class getCallerClass(int depth); /** Retrieves the access flags written to the class file. For diff --git a/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java index 24aa225b89e..898f56c214f 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/ReflectionFactory.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Executable; diff --git a/jdk/src/java.base/share/classes/sun/reflect/SerializationConstructorAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/SerializationConstructorAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/SerializationConstructorAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/SerializationConstructorAccessorImpl.java index a26d0664c56..9dbbf0d2c77 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/SerializationConstructorAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/SerializationConstructorAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /**

Java serialization (in java.io) expects to be able to instantiate a class and invoke a no-arg constructor of that diff --git a/jdk/src/java.base/share/classes/sun/reflect/SignatureIterator.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/SignatureIterator.java similarity index 97% rename from jdk/src/java.base/share/classes/sun/reflect/SignatureIterator.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/SignatureIterator.java index ea7fd3c80f2..e0d35c02772 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/SignatureIterator.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/SignatureIterator.java @@ -23,11 +23,11 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** Assists in iterating down a method's signature */ -public class SignatureIterator { +class SignatureIterator { private final String sig; private int idx; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UTF8.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UTF8.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UTF8.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UTF8.java index ae482f329c9..446060dba8b 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UTF8.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UTF8.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; /** It is necessary to use a "bootstrap" UTF-8 encoder for encoding constant pool entries because the character set converters rely on diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeBooleanFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeBooleanFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeBooleanFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeBooleanFieldAccessorImpl.java index cf929b762a9..32b33bed625 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeBooleanFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeByteFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeByteFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeByteFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeByteFieldAccessorImpl.java index 15564220ecf..df6a8be164b 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeByteFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeCharacterFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeCharacterFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeCharacterFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeCharacterFieldAccessorImpl.java index bd27f00b1bd..4dcf0756eb1 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeCharacterFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeDoubleFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeDoubleFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeDoubleFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeDoubleFieldAccessorImpl.java index a43ac29368b..17b7377c6f0 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeDoubleFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java index 72689b3e5f3..b00306b3076 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java index d54c7f8a6f6..d75db5374cb 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFloatFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFloatFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeFloatFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFloatFieldAccessorImpl.java index d2410987999..690fe8f4965 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeFloatFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeIntegerFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeIntegerFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeIntegerFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeIntegerFieldAccessorImpl.java index df802e3b2ad..c0993abeb23 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeIntegerFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeLongFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeLongFieldAccessorImpl.java index 8e76ea193fe..d92023dc079 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeObjectFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeObjectFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java index bb5b5b6cf6e..ea3c70045da 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeObjectFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java index cc31cb4910d..5144a8fbd79 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedByteFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedByteFieldAccessorImpl.java index ae239a807f4..7cd87931a52 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java index e322e1d3e04..634f6abe0d2 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java index 1fb71f5c447..48b59ca7251 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFieldAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFieldAccessorImpl.java index 5cf6c5ee5c7..fcfa9f16b00 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java index 0b7906d4830..9b44e1379a0 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java index df737fd0119..f960425638d 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedLongFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedLongFieldAccessorImpl.java index b77d4d1d9e9..25434e84f00 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java index 1a502ab72d8..fcb45289886 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedShortFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedShortFieldAccessorImpl.java index c5ea9bb6caa..1e68e3dad98 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java index 65dabb0fba6..67d98280938 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java index 136728b4594..93ffb209a3a 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java index 6015baf82a8..8c9cfe03e41 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java index 5433b4ec82a..5178d639961 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java index 74b40571eab..c086fc3d3e9 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java index fe69684c1d8..410a99cd168 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java index 3e420f92a39..1411f364b5b 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java index d25f4ac8a56..dc357e1f005 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java index 8bea19e829a..4b35509bb60 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java index 631bd7ae333..63285054497 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeShortFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeShortFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeShortFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeShortFieldAccessorImpl.java index 05ea337f49c..d864fb4b855 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeShortFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticBooleanFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticBooleanFieldAccessorImpl.java index b7572b54e31..26bb655cbea 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticBooleanFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticByteFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticByteFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticByteFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticByteFieldAccessorImpl.java index 78eeb86842f..c3e93ee38bb 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticByteFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticByteFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticCharacterFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticCharacterFieldAccessorImpl.java index 2dd3a597681..7f2acd4e99c 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticCharacterFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticDoubleFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticDoubleFieldAccessorImpl.java index b07df4f987f..1f010ad9832 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticDoubleFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFieldAccessorImpl.java similarity index 98% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFieldAccessorImpl.java index e87ba31b543..3cfa97bc52c 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; import java.lang.reflect.Modifier; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFloatFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFloatFieldAccessorImpl.java index 2929727b6ad..10ba9cdef39 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFloatFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticIntegerFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticIntegerFieldAccessorImpl.java index 963620a06fb..f6ae4e15650 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticIntegerFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticLongFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticLongFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticLongFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticLongFieldAccessorImpl.java index a8dedd060cc..a1d086b1931 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticLongFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticLongFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticObjectFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticObjectFieldAccessorImpl.java index e8b4548e422..7381be2ca2f 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticObjectFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticShortFieldAccessorImpl.java b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticShortFieldAccessorImpl.java similarity index 99% rename from jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticShortFieldAccessorImpl.java rename to jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticShortFieldAccessorImpl.java index 9ac6cd6533b..8e17a6f4ff1 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeStaticShortFieldAccessorImpl.java +++ b/jdk/src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticShortFieldAccessorImpl.java @@ -23,7 +23,7 @@ * questions. */ -package sun.reflect; +package jdk.internal.reflect; import java.lang.reflect.Field; diff --git a/jdk/src/java.base/share/classes/module-info.java b/jdk/src/java.base/share/classes/module-info.java index 2d1aae28616..8cc37dd7b2d 100644 --- a/jdk/src/java.base/share/classes/module-info.java +++ b/jdk/src/java.base/share/classes/module-info.java @@ -86,9 +86,6 @@ module java.base { // see JDK-8044773 exports jdk.net; - // This will move to a jdk.internal module via JEP-260 - exports sun.reflect; - // the service types defined by the APIs in this module @@ -180,6 +177,14 @@ module java.base { jdk.jvmstat; exports jdk.internal.ref to java.desktop; + exports jdk.internal.reflect to + java.corba, + java.logging, + java.sql, + java.sql.rowset, + jdk.dynalink, + jdk.scripting.nashorn, + jdk.unsupported; exports jdk.internal.vm.annotation to jdk.unsupported; exports jdk.internal.util.jar to diff --git a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java index 2d6b234a63d..456909fde1c 100644 --- a/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java +++ b/jdk/src/java.base/share/classes/sun/invoke/util/VerifyAccess.java @@ -28,7 +28,7 @@ package sun.invoke.util; import java.lang.reflect.Modifier; import static java.lang.reflect.Modifier.*; import java.lang.reflect.Module; -import sun.reflect.Reflection; +import jdk.internal.reflect.Reflection; /** * This class centralizes information about the JVM's linkage access control. diff --git a/jdk/src/java.base/share/classes/sun/reflect/FieldInfo.java b/jdk/src/java.base/share/classes/sun/reflect/FieldInfo.java deleted file mode 100644 index 72abd07b861..00000000000 --- a/jdk/src/java.base/share/classes/sun/reflect/FieldInfo.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package sun.reflect; - -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; - -/** NOTE: obsolete as of JDK 1.4 B75 and should be removed from the - workspace (FIXME) */ - -public class FieldInfo { - // Set by the VM directly. Do not move these fields around or add - // others before (or after) them without also modifying the VM's code. - private String name; - private String signature; - private int modifiers; - // This is compatible with the old reflection implementation's - // "slot" value to allow jdk.internal.misc.Unsafe to work - private int slot; - - // Not really necessary to provide a constructor since the VM - // creates these directly - FieldInfo() { - } - - public String name() { - return name; - } - - /** This is in "external" format, i.e. having '.' as separator - rather than '/' */ - public String signature() { - return signature; - } - - public int modifiers() { - return modifiers; - } - - public int slot() { - return slot; - } - - /** Convenience routine */ - public boolean isPublic() { - return (Modifier.isPublic(modifiers())); - } -} diff --git a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java index 02a5a3f480b..20f911098cd 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java +++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java @@ -32,7 +32,7 @@ import java.nio.BufferUnderflowException; import java.lang.reflect.*; import java.security.AccessController; import java.security.PrivilegedAction; -import sun.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool; import sun.reflect.generics.parser.SignatureParser; import sun.reflect.generics.tree.TypeSignature; diff --git a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java index ee3a6c6d0c0..98d46526326 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java +++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java @@ -37,7 +37,7 @@ import java.util.Objects; import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.JavaLangAccess; -import sun.reflect.ReflectionFactory; +import jdk.internal.reflect.ReflectionFactory; public final class AnnotationSupport { private static final JavaLangAccess LANG_ACCESS = SharedSecrets.getJavaLangAccess(); diff --git a/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java b/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java index c18c14c1b7b..2873db8e1b3 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java +++ b/jdk/src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java @@ -36,7 +36,7 @@ import java.util.LinkedHashMap; import java.util.Map; import jdk.internal.misc.SharedSecrets; import jdk.internal.misc.JavaLangAccess; -import sun.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool; import static sun.reflect.annotation.TypeAnnotation.*; /** diff --git a/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java b/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java index 97bd9c2e303..07f53c490b5 100644 --- a/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java +++ b/jdk/src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java @@ -30,7 +30,7 @@ import java.lang.reflect.Member; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.lang.reflect.Proxy; -import sun.reflect.Reflection; +import jdk.internal.reflect.Reflection; import sun.security.util.SecurityConstants; public final class ReflectUtil { diff --git a/jdk/src/java.base/share/native/libjava/Class.c b/jdk/src/java.base/share/native/libjava/Class.c index 07a3f6db716..6a812c49036 100644 --- a/jdk/src/java.base/share/native/libjava/Class.c +++ b/jdk/src/java.base/share/native/libjava/Class.c @@ -43,7 +43,7 @@ extern jboolean VerifyFixClassname(char *utf_name); #define OBJ "Ljava/lang/Object;" #define CLS "Ljava/lang/Class;" -#define CPL "Lsun/reflect/ConstantPool;" +#define CPL "Ljdk/internal/reflect/ConstantPool;" #define STR "Ljava/lang/String;" #define FLD "Ljava/lang/reflect/Field;" #define MHD "Ljava/lang/reflect/Method;" diff --git a/jdk/src/java.base/share/native/libjava/ConstantPool.c b/jdk/src/java.base/share/native/libjava/ConstantPool.c index f7f744144e3..3fb7b74e518 100644 --- a/jdk/src/java.base/share/native/libjava/ConstantPool.c +++ b/jdk/src/java.base/share/native/libjava/ConstantPool.c @@ -24,111 +24,111 @@ */ #include "jvm.h" -#include "sun_reflect_ConstantPool.h" +#include "jdk_internal_reflect_ConstantPool.h" -JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getSize0 +JNIEXPORT jint JNICALL Java_jdk_internal_reflect_ConstantPool_getSize0 (JNIEnv *env, jobject unused, jobject jcpool) { return JVM_ConstantPoolGetSize(env, unused, jcpool); } -JNIEXPORT jclass JNICALL Java_sun_reflect_ConstantPool_getClassAt0 +JNIEXPORT jclass JNICALL Java_jdk_internal_reflect_ConstantPool_getClassAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetClassAt(env, unused, jcpool, index); } -JNIEXPORT jclass JNICALL Java_sun_reflect_ConstantPool_getClassAtIfLoaded0 +JNIEXPORT jclass JNICALL Java_jdk_internal_reflect_ConstantPool_getClassAtIfLoaded0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetClassAtIfLoaded(env, unused, jcpool, index); } -JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getClassRefIndexAt0 +JNIEXPORT jint JNICALL Java_jdk_internal_reflect_ConstantPool_getClassRefIndexAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetClassRefIndexAt(env, unused, jcpool, index); } -JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getMethodAt0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_ConstantPool_getMethodAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetMethodAt(env, unused, jcpool, index); } -JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getMethodAtIfLoaded0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_ConstantPool_getMethodAtIfLoaded0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetMethodAtIfLoaded(env, unused, jcpool, index); } -JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getFieldAt0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_ConstantPool_getFieldAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetFieldAt(env, unused, jcpool, index); } -JNIEXPORT jobject JNICALL Java_sun_reflect_ConstantPool_getFieldAtIfLoaded0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_ConstantPool_getFieldAtIfLoaded0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetFieldAtIfLoaded(env, unused, jcpool, index); } -JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getMemberRefInfoAt0 +JNIEXPORT jobjectArray JNICALL Java_jdk_internal_reflect_ConstantPool_getMemberRefInfoAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetMemberRefInfoAt(env, unused, jcpool, index); } -JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getNameAndTypeRefIndexAt0 +JNIEXPORT jint JNICALL Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefIndexAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetNameAndTypeRefIndexAt(env, unused, jcpool, index); } -JNIEXPORT jobjectArray JNICALL Java_sun_reflect_ConstantPool_getNameAndTypeRefInfoAt0 +JNIEXPORT jobjectArray JNICALL Java_jdk_internal_reflect_ConstantPool_getNameAndTypeRefInfoAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetNameAndTypeRefInfoAt(env, unused, jcpool, index); } -JNIEXPORT jint JNICALL Java_sun_reflect_ConstantPool_getIntAt0 +JNIEXPORT jint JNICALL Java_jdk_internal_reflect_ConstantPool_getIntAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetIntAt(env, unused, jcpool, index); } -JNIEXPORT jlong JNICALL Java_sun_reflect_ConstantPool_getLongAt0 +JNIEXPORT jlong JNICALL Java_jdk_internal_reflect_ConstantPool_getLongAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetLongAt(env, unused, jcpool, index); } -JNIEXPORT jfloat JNICALL Java_sun_reflect_ConstantPool_getFloatAt0 +JNIEXPORT jfloat JNICALL Java_jdk_internal_reflect_ConstantPool_getFloatAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetFloatAt(env, unused, jcpool, index); } -JNIEXPORT jdouble JNICALL Java_sun_reflect_ConstantPool_getDoubleAt0 +JNIEXPORT jdouble JNICALL Java_jdk_internal_reflect_ConstantPool_getDoubleAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetDoubleAt(env, unused, jcpool, index); } -JNIEXPORT jstring JNICALL Java_sun_reflect_ConstantPool_getStringAt0 +JNIEXPORT jstring JNICALL Java_jdk_internal_reflect_ConstantPool_getStringAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetStringAt(env, unused, jcpool, index); } -JNIEXPORT jstring JNICALL Java_sun_reflect_ConstantPool_getUTF8At0 +JNIEXPORT jstring JNICALL Java_jdk_internal_reflect_ConstantPool_getUTF8At0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetUTF8At(env, unused, jcpool, index); } -JNIEXPORT jbyte JNICALL Java_sun_reflect_ConstantPool_getTagAt0 +JNIEXPORT jbyte JNICALL Java_jdk_internal_reflect_ConstantPool_getTagAt0 (JNIEnv *env, jobject unused, jobject jcpool, jint index) { return JVM_ConstantPoolGetTagAt(env, unused, jcpool, index); diff --git a/jdk/src/java.base/share/native/libjava/NativeAccessors.c b/jdk/src/java.base/share/native/libjava/NativeAccessors.c index e904cf98fcd..53714124502 100644 --- a/jdk/src/java.base/share/native/libjava/NativeAccessors.c +++ b/jdk/src/java.base/share/native/libjava/NativeAccessors.c @@ -24,16 +24,16 @@ */ #include "jvm.h" -#include "sun_reflect_NativeConstructorAccessorImpl.h" -#include "sun_reflect_NativeMethodAccessorImpl.h" +#include "jdk_internal_reflect_NativeConstructorAccessorImpl.h" +#include "jdk_internal_reflect_NativeMethodAccessorImpl.h" -JNIEXPORT jobject JNICALL Java_sun_reflect_NativeMethodAccessorImpl_invoke0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_NativeMethodAccessorImpl_invoke0 (JNIEnv *env, jclass unused, jobject m, jobject obj, jobjectArray args) { return JVM_InvokeMethod(env, m, obj, args); } -JNIEXPORT jobject JNICALL Java_sun_reflect_NativeConstructorAccessorImpl_newInstance0 +JNIEXPORT jobject JNICALL Java_jdk_internal_reflect_NativeConstructorAccessorImpl_newInstance0 (JNIEnv *env, jclass unused, jobject c, jobjectArray args) { return JVM_NewInstanceFromConstructor(env, c, args); diff --git a/jdk/src/java.base/share/native/libjava/Reflection.c b/jdk/src/java.base/share/native/libjava/Reflection.c index 02b90138bcc..0a5327eb1fa 100644 --- a/jdk/src/java.base/share/native/libjava/Reflection.c +++ b/jdk/src/java.base/share/native/libjava/Reflection.c @@ -25,22 +25,22 @@ #include "jni.h" #include "jvm.h" -#include "sun_reflect_Reflection.h" +#include "jdk_internal_reflect_Reflection.h" JNIEXPORT jclass JNICALL -Java_sun_reflect_Reflection_getCallerClass__(JNIEnv *env, jclass unused) +Java_jdk_internal_reflect_Reflection_getCallerClass__(JNIEnv *env, jclass unused) { return JVM_GetCallerClass(env, JVM_CALLER_DEPTH); } JNIEXPORT jclass JNICALL -Java_sun_reflect_Reflection_getCallerClass__I(JNIEnv *env, jclass unused, jint depth) +Java_jdk_internal_reflect_Reflection_getCallerClass__I(JNIEnv *env, jclass unused, jint depth) { return JVM_GetCallerClass(env, depth); } JNIEXPORT jint JNICALL -Java_sun_reflect_Reflection_getClassAccessFlags(JNIEnv *env, jclass unused, jclass cls) +Java_jdk_internal_reflect_Reflection_getClassAccessFlags(JNIEnv *env, jclass unused, jclass cls) { return JVM_GetClassAccessFlags(env, cls); } diff --git a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java index 07b06fd38c3..d8ada0c4c08 100644 --- a/jdk/src/java.logging/share/classes/java/util/logging/Logger.java +++ b/jdk/src/java.logging/share/classes/java/util/logging/Logger.java @@ -38,8 +38,8 @@ import java.util.Objects; import java.util.ResourceBundle; import java.util.concurrent.CopyOnWriteArrayList; import java.util.function.Supplier; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** * A Logger object is used to log messages for a specific diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java index 7578c41d963..931f351a196 100644 --- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java +++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java @@ -30,8 +30,8 @@ import java.lang.reflect.*; import java.util.Arrays; import java.util.Vector; import javax.sql.rowset.RowSetWarning; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import sun.reflect.misc.ReflectUtil; /** @@ -141,7 +141,7 @@ public class SerialJavaObject implements Serializable, Cloneable { * Check if the caller is allowed to access the specified class's package. * If access is denied, throw a SecurityException. */ - Class caller = sun.reflect.Reflection.getCallerClass(); + Class caller = Reflection.getCallerClass(); if (ReflectUtil.needsPackageAccessCheck(caller.getClassLoader(), c.getClassLoader())) { ReflectUtil.checkPackageAccess(c); diff --git a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java index 331239e3733..5530fda159d 100644 --- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java +++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java @@ -36,8 +36,8 @@ import java.security.PrivilegedAction; import java.util.concurrent.CopyOnWriteArrayList; import java.util.stream.Stream; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; /** diff --git a/jdk/src/jdk.unsupported/share/classes/module-info.java b/jdk/src/jdk.unsupported/share/classes/module-info.java index e83c5012b69..a13d3428022 100644 --- a/jdk/src/jdk.unsupported/share/classes/module-info.java +++ b/jdk/src/jdk.unsupported/share/classes/module-info.java @@ -25,6 +25,6 @@ module jdk.unsupported { exports sun.misc; - //exports sun.reflect; + exports sun.reflect; } diff --git a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java index c69b66020ab..a2ff7add481 100644 --- a/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java +++ b/jdk/src/jdk.unsupported/share/classes/sun/misc/Unsafe.java @@ -27,8 +27,8 @@ package sun.misc; import jdk.internal.vm.annotation.ForceInline; import jdk.internal.misc.VM; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; import java.lang.reflect.Field; import java.security.ProtectionDomain; @@ -55,7 +55,7 @@ import java.security.ProtectionDomain; public final class Unsafe { static { - sun.reflect.Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); + Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe"); } private Unsafe() {} diff --git a/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java b/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java new file mode 100644 index 00000000000..29d864557ac --- /dev/null +++ b/jdk/src/jdk.unsupported/share/classes/sun/reflect/Reflection.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.reflect; + +public class Reflection { + + private Reflection() { } + + /** + * @deprecated This method is an internal API and will be removed. + * Use {@link StackWalker} to walk the stack and obtain the caller class + * with {@link StackWalker.StackFrame#getDeclaringClass} instead. + */ + @Deprecated(forRemoval=true) + public static Class getCallerClass(int depth) { + if (depth < 0) + throw new InternalError("depth must be positive"); + + // increase depth to account for delegation to the internal impl + return jdk.internal.reflect.Reflection.getCallerClass(depth + 1); + } +} diff --git a/jdk/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java b/jdk/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java new file mode 100644 index 00000000000..85f4e4cb299 --- /dev/null +++ b/jdk/src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.reflect; + +import java.lang.reflect.Constructor; +import java.security.AccessController; +import java.security.Permission; +import java.security.PrivilegedAction; + +public class ReflectionFactory { + + private static final ReflectionFactory soleInstance = new ReflectionFactory(); + private final jdk.internal.reflect.ReflectionFactory delegate; + + private ReflectionFactory() { + delegate = AccessController.doPrivileged( + new PrivilegedAction() { + public jdk.internal.reflect.ReflectionFactory run() { + return jdk.internal.reflect.ReflectionFactory.getReflectionFactory(); + } + }); + } + + private static final Permission REFLECTION_FACTORY_ACCESS_PERM + = new RuntimePermission("reflectionFactoryAccess"); + + /** + * Provides the caller with the capability to instantiate reflective + * objects. + * + *

First, if there is a security manager, its {@code checkPermission} + * method is called with a {@link java.lang.RuntimePermission} with target + * {@code "reflectionFactoryAccess"}. This may result in a securit + * exception. + * + *

The returned {@code ReflectionFactory} object should be carefully + * guarded by the caller, since it can be used to read and write private + * data and invoke private methods, as well as to load unverified bytecodes. + * It must never be passed to untrusted code. + * + * @throws SecurityException if a security manager exists and its + * {@code checkPermission} method doesn't allow access to + * the RuntimePermission "reflectionFactoryAccess". + */ + public static ReflectionFactory getReflectionFactory() { + SecurityManager security = System.getSecurityManager(); + if (security != null) { + security.checkPermission(REFLECTION_FACTORY_ACCESS_PERM); + } + return soleInstance; + } + + public Constructor newConstructorForSerialization(Class classToInstantiate, + Constructor constructorToCall) + { + return delegate.newConstructorForSerialization(classToInstantiate, + constructorToCall); + } +} + diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups index 53deee5c732..cf3f0abfd9d 100644 --- a/jdk/test/TEST.groups +++ b/jdk/test/TEST.groups @@ -76,6 +76,7 @@ jdk_lang = \ sun/invoke \ sun/misc \ sun/reflect \ + jdk/internal/reflect \ jdk/lambda \ jdk/internal/misc \ jdk/internal/ref \ @@ -495,8 +496,8 @@ needs_jdk = \ sun/management/jmxremote/bootstrap/CustomLauncherTest.java \ sun/misc/JarIndex/metaInfFilenames/Basic.java \ sun/misc/JarIndex/JarIndexMergeForClassLoaderTest.java \ - sun/reflect/CallerSensitive/CallerSensitiveFinder.java \ - sun/reflect/CallerSensitive/MissingCallerSensitive.java \ + jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java \ + jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java \ sun/security/util/Resources/NewNamesFormat.java \ vm/verifier/defaultMethods/DefaultMethodRegressionTestsRun.java \ javax/xml/ws/clientjar/TestWsImport.java \ diff --git a/jdk/test/java/lang/StackWalker/DumpStackTest.java b/jdk/test/java/lang/StackWalker/DumpStackTest.java index 667e325a8f0..e15a289381f 100644 --- a/jdk/test/java/lang/StackWalker/DumpStackTest.java +++ b/jdk/test/java/lang/StackWalker/DumpStackTest.java @@ -85,9 +85,9 @@ public class DumpStackTest { new CallFrame(DumpStackTest.class, "test"), new CallFrame(DumpStackTest.class, "main"), // if invoked from jtreg - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke0"), // non-public class - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke"), - new CallFrame("sun.reflect.DelegatingMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke0"), // non-public class + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.DelegatingMethodAccessorImpl", "invoke"), new CallFrame(Method.class, "invoke"), new CallFrame(Thread.class, "run"), }; @@ -141,9 +141,9 @@ public class DumpStackTest { new CallFrame(DumpStackTest.class, "testLambda"), new CallFrame(DumpStackTest.class, "main"), // if invoked from jtreg - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke0"), - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke"), - new CallFrame("sun.reflect.DelegatingMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke0"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.DelegatingMethodAccessorImpl", "invoke"), new CallFrame(Method.class, "invoke"), new CallFrame(Thread.class, "run") }; @@ -164,16 +164,16 @@ public class DumpStackTest { CallFrame[] callStack = new CallFrame[] { new CallFrame(Thread.class, "getStackTrace"), new CallFrame(DumpStackTest.class, "methodInvoke"), - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke0"), - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke"), - new CallFrame("sun.reflect.DelegatingMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke0"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.DelegatingMethodAccessorImpl", "invoke"), new CallFrame(Method.class, "invoke"), new CallFrame(DumpStackTest.class, "testMethodInvoke"), new CallFrame(DumpStackTest.class, "main"), // if invoked from jtreg - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke0"), - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke"), - new CallFrame("sun.reflect.DelegatingMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke0"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.DelegatingMethodAccessorImpl", "invoke"), new CallFrame(Method.class, "invoke"), new CallFrame(Thread.class, "run") }; @@ -199,9 +199,9 @@ public class DumpStackTest { new CallFrame(DumpStackTest.class, "testMethodHandle"), new CallFrame(DumpStackTest.class, "main"), // if invoked from jtreg - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke0"), - new CallFrame("sun.reflect.NativeMethodAccessorImpl", "invoke"), - new CallFrame("sun.reflect.DelegatingMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke0"), + new CallFrame("jdk.internal.reflect.NativeMethodAccessorImpl", "invoke"), + new CallFrame("jdk.internal.reflect.DelegatingMethodAccessorImpl", "invoke"), new CallFrame(Method.class, "invoke"), new CallFrame(Thread.class, "run") }; diff --git a/jdk/test/java/lang/StackWalker/EmbeddedStackWalkTest.java b/jdk/test/java/lang/StackWalker/EmbeddedStackWalkTest.java index f01e64eeb14..00bcb213596 100644 --- a/jdk/test/java/lang/StackWalker/EmbeddedStackWalkTest.java +++ b/jdk/test/java/lang/StackWalker/EmbeddedStackWalkTest.java @@ -75,7 +75,7 @@ public class EmbeddedStackWalkTest { if (loops == 0) { String caller = walker.walk(s -> s.map(StackFrame::getClassName) - .filter(cn -> !cn.startsWith("sun.reflect.") && !cn.startsWith("java.lang.invoke")) + .filter(cn -> !cn.startsWith("jdk.internal.reflect.") && !cn.startsWith("java.lang.invoke")) .skip(2).findFirst() ).get(); assertEquals(caller, C1.class.getName()); @@ -122,7 +122,7 @@ public class EmbeddedStackWalkTest { static void call(StackWalker walker) { String caller = walker.walk(s -> s.map(StackFrame::getClassName) - .filter(cn -> !cn.startsWith("sun.reflect.") && !cn.startsWith("java.lang.invoke")) + .filter(cn -> !cn.startsWith("jdk.internal.reflect.") && !cn.startsWith("java.lang.invoke")) .skip(2).findFirst() ).get(); assertEquals(caller, C2.class.getName()); diff --git a/jdk/test/java/lang/StackWalker/HiddenFrames.java b/jdk/test/java/lang/StackWalker/HiddenFrames.java index d9f6dac28d7..d030c52b46f 100644 --- a/jdk/test/java/lang/StackWalker/HiddenFrames.java +++ b/jdk/test/java/lang/StackWalker/HiddenFrames.java @@ -98,7 +98,7 @@ public class HiddenFrames { void checkFrame(StackFrame frame) { String cn = frame.getClassName(); - if (cn.startsWith("java.lang.reflect.") || cn.startsWith("sun.reflect.")) { + if (cn.startsWith("java.lang.reflect.") || cn.startsWith("jdk.internal.reflect.")) { reflects.add(frame); } if (cn.contains("$$Lambda$")) { diff --git a/jdk/test/java/lang/StackWalker/MultiThreadStackWalk.java b/jdk/test/java/lang/StackWalker/MultiThreadStackWalk.java index 18ec9454ee0..fa520719fe4 100644 --- a/jdk/test/java/lang/StackWalker/MultiThreadStackWalk.java +++ b/jdk/test/java/lang/StackWalker/MultiThreadStackWalk.java @@ -46,8 +46,8 @@ import static java.lang.StackWalker.Option.*; public class MultiThreadStackWalk { static Set infrastructureClasses = new TreeSet<>(Arrays.asList( - "sun.reflect.NativeMethodAccessorImpl", - "sun.reflect.DelegatingMethodAccessorImpl", + "jdk.internal.reflect.NativeMethodAccessorImpl", + "jdk.internal.reflect.DelegatingMethodAccessorImpl", "java.lang.reflect.Method", "com.sun.javatest.regtest.MainWrapper$MainThread", "java.lang.Thread" diff --git a/jdk/test/java/lang/StackWalker/StackWalkTest.java b/jdk/test/java/lang/StackWalker/StackWalkTest.java index 7bbcc6150f8..b2f657f7cfa 100644 --- a/jdk/test/java/lang/StackWalker/StackWalkTest.java +++ b/jdk/test/java/lang/StackWalker/StackWalkTest.java @@ -59,8 +59,8 @@ public class StackWalkTest { private static final int MAX_RANDOM_DEPTH = 1000; static final Set infrastructureClasses = new TreeSet<>(Arrays.asList( - "sun.reflect.NativeMethodAccessorImpl", - "sun.reflect.DelegatingMethodAccessorImpl", + "jdk.internal.reflect.NativeMethodAccessorImpl", + "jdk.internal.reflect.DelegatingMethodAccessorImpl", "java.lang.reflect.Method", "com.sun.javatest.regtest.MainWrapper$MainThread", "com.sun.javatest.regtest.agent.MainWrapper$MainThread", diff --git a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java index b5f8653bc1b..d68f91c0257 100644 --- a/jdk/test/java/lang/StackWalker/VerifyStackTrace.java +++ b/jdk/test/java/lang/StackWalker/VerifyStackTrace.java @@ -101,9 +101,9 @@ public class VerifyStackTrace { "2: VerifyStackTrace$Handle.execute(VerifyStackTrace.java:147)\n" + "3: VerifyStackTrace$Handle.run(VerifyStackTrace.java:160)\n" + "4: VerifyStackTrace.invoke(VerifyStackTrace.java:190)\n" + - "5: sun.reflect.NativeMethodAccessorImpl.invoke0(java.base/Native Method)\n" + - "6: sun.reflect.NativeMethodAccessorImpl.invoke(java.base/NativeMethodAccessorImpl.java:62)\n" + - "7: sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base/DelegatingMethodAccessorImpl.java:43)\n" + + "5: jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base/Native Method)\n" + + "6: jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base/NativeMethodAccessorImpl.java:62)\n" + + "7: jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base/DelegatingMethodAccessorImpl.java:43)\n" + "8: java.lang.reflect.Method.invoke(java.base/Method.java:520)\n" + "9: VerifyStackTrace$1.run(VerifyStackTrace.java:220)\n" + "10: java.security.AccessController.doPrivileged(java.base/Native Method)\n" + @@ -138,9 +138,9 @@ public class VerifyStackTrace { "5: java.lang.invoke.LambdaForm$MH/1395089624.invoke_MT(java.base/LambdaForm$MH)\n" + "6: VerifyStackTrace$Handle.run(VerifyStackTrace.java:162)\n" + "7: VerifyStackTrace.invoke(VerifyStackTrace.java:192)\n" + - "8: sun.reflect.NativeMethodAccessorImpl.invoke0(java.base/Native Method)\n" + - "9: sun.reflect.NativeMethodAccessorImpl.invoke(java.base/NativeMethodAccessorImpl.java:62)\n" + - "10: sun.reflect.DelegatingMethodAccessorImpl.invoke(java.base/DelegatingMethodAccessorImpl.java:43)\n" + + "8: jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base/Native Method)\n" + + "9: jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base/NativeMethodAccessorImpl.java:62)\n" + + "10: jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base/DelegatingMethodAccessorImpl.java:43)\n" + "11: java.lang.reflect.Method.invoke(java.base/Method.java:520)\n" + "12: VerifyStackTrace$1.run(VerifyStackTrace.java:222)\n" + "13: java.security.AccessController.doPrivileged(java.base/Native Method)\n" + diff --git a/jdk/test/java/lang/invoke/RevealDirectTest.java b/jdk/test/java/lang/invoke/RevealDirectTest.java index 55cd0b62aa7..d2f9f7d5e01 100644 --- a/jdk/test/java/lang/invoke/RevealDirectTest.java +++ b/jdk/test/java/lang/invoke/RevealDirectTest.java @@ -24,7 +24,7 @@ /* * @test * @summary verify Lookup.revealDirect on a variety of input handles - * @modules java.base/sun.reflect + * @modules java.base/jdk.internal.reflect * @compile -XDignore.symbol.file RevealDirectTest.java * @run junit/othervm -ea -esa test.java.lang.invoke.RevealDirectTest * @@ -311,7 +311,7 @@ public class RevealDirectTest { if (!(mem instanceof AnnotatedElement)) return false; AnnotatedElement ae = (AnnotatedElement) mem; if (CS_CLASS != null) - return ae.isAnnotationPresent(sun.reflect.CallerSensitive.class); + return ae.isAnnotationPresent(jdk.internal.reflect.CallerSensitive.class); for (java.lang.annotation.Annotation a : ae.getDeclaredAnnotations()) { if (a.toString().contains(".CallerSensitive")) return true; @@ -322,7 +322,7 @@ public class RevealDirectTest { static { Class c = null; try { - c = sun.reflect.CallerSensitive.class; + c = jdk.internal.reflect.CallerSensitive.class; } catch (SecurityException | LinkageError ex) { } CS_CLASS = c; diff --git a/jdk/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java b/jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java similarity index 100% rename from jdk/test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java rename to jdk/test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java diff --git a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java b/jdk/test/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java similarity index 94% rename from jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java rename to jdk/test/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java index d4805fb1d2d..2be9c57a649 100644 --- a/jdk/test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java +++ b/jdk/test/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java @@ -47,7 +47,7 @@ import java.util.stream.Stream; * @test * @bug 8010117 * @summary Verify if CallerSensitive methods are annotated with - * sun.reflect.CallerSensitive annotation + * CallerSensitive annotation * @modules jdk.jdeps/com.sun.tools.classfile jdk.jdeps/com.sun.tools.jdeps * @build CallerSensitiveFinder * @run main/othervm/timeout=900 CallerSensitiveFinder @@ -97,7 +97,7 @@ public class CallerSensitiveFinder { } private ReferenceFinder.Filter getFilter() { - final String classname = "sun/reflect/Reflection"; + final String classname = "jdk/internal/reflect/Reflection"; final String method = "getCallerClass"; return new ReferenceFinder.Filter() { public boolean accept(ConstantPool cpool, CPRefInfo cpref) { @@ -115,6 +115,12 @@ public class CallerSensitiveFinder { return new ReferenceFinder.Visitor() { public void visit(ClassFile cf, Method m, List refs) { try { + // ignore jdk.unsupported/sun.reflect.Reflection.getCallerClass + // which is a "special" delegate to the internal getCallerClass + if (cf.getName().equals("sun/reflect/Reflection") && + m.getName(cf.constant_pool).equals("getCallerClass")) + return; + String name = String.format("%s#%s %s", cf.getName(), m.getName(cf.constant_pool), m.descriptor.getValue(cf.constant_pool)); @@ -160,7 +166,7 @@ public class CallerSensitiveFinder { } } - private static final String CALLER_SENSITIVE_ANNOTATION = "Lsun/reflect/CallerSensitive;"; + private static final String CALLER_SENSITIVE_ANNOTATION = "Ljdk/internal/reflect/CallerSensitive;"; private static boolean isCallerSensitive(Method m, ConstantPool cp) throws ConstantPoolException { diff --git a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java b/jdk/test/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java similarity index 90% rename from jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java rename to jdk/test/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java index fb2b6c20a7b..b9d4706fe40 100644 --- a/jdk/test/sun/reflect/CallerSensitive/MissingCallerSensitive.java +++ b/jdk/test/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java @@ -26,7 +26,7 @@ * @test * @bug 8010117 * @summary Test CallerSensitiveFinder to find missing annotation - * @modules java.base/sun.reflect + * @modules java.base/jdk.internal.reflect * jdk.jdeps/com.sun.tools.classfile * jdk.jdeps/com.sun.tools.jdeps * @compile -XDignore.symbol.file MissingCallerSensitive.java @@ -38,6 +38,8 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.*; import java.util.stream.Stream; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; public class MissingCallerSensitive { public static void main(String[] args) throws Exception { @@ -56,14 +58,14 @@ public class MissingCallerSensitive { } } - @sun.reflect.CallerSensitive + @CallerSensitive public ClassLoader getCallerLoader() { - Class c = sun.reflect.Reflection.getCallerClass(); + Class c = Reflection.getCallerClass(); return c.getClassLoader(); } public ClassLoader missingCallerSensitiveAnnotation() { - Class c = sun.reflect.Reflection.getCallerClass(); + Class c = Reflection.getCallerClass(); return c.getClassLoader(); } } diff --git a/jdk/test/sun/reflect/Reflection/GetCallerClass.java b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClass.java similarity index 87% rename from jdk/test/sun/reflect/Reflection/GetCallerClass.java rename to jdk/test/jdk/internal/reflect/Reflection/GetCallerClass.java index 8c822a5f517..163a80ad088 100644 --- a/jdk/test/sun/reflect/Reflection/GetCallerClass.java +++ b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClass.java @@ -24,14 +24,14 @@ package boot; public class GetCallerClass { - @sun.reflect.CallerSensitive + @jdk.internal.reflect.CallerSensitive public ClassLoader getCallerLoader() { - Class c = sun.reflect.Reflection.getCallerClass(); + Class c = jdk.internal.reflect.Reflection.getCallerClass(); return c.getClassLoader(); } public ClassLoader missingCallerSensitiveAnnotation() { - Class c = sun.reflect.Reflection.getCallerClass(); + Class c = jdk.internal.reflect.Reflection.getCallerClass(); return c.getClassLoader(); } } diff --git a/jdk/test/sun/reflect/Reflection/GetCallerClassTest.java b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.java similarity index 96% rename from jdk/test/sun/reflect/Reflection/GetCallerClassTest.java rename to jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.java index 3e96f4b0a70..059da32a9c1 100644 --- a/jdk/test/sun/reflect/Reflection/GetCallerClassTest.java +++ b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.java @@ -23,8 +23,8 @@ import boot.GetCallerClass; import java.lang.reflect.*; -import sun.reflect.CallerSensitive; -import sun.reflect.Reflection; +import jdk.internal.reflect.CallerSensitive; +import jdk.internal.reflect.Reflection; public class GetCallerClassTest { private final GetCallerClass gcc; // boot.GetCallerClass is in bootclasspath @@ -104,7 +104,7 @@ public class GetCallerClassTest { throw new RuntimeException("Unexpected error: " + e.getMessage(), e); } - if (!stackTrace[0].getClassName().equals("sun.reflect.Reflection") || + if (!stackTrace[0].getClassName().equals("jdk.internal.reflect.Reflection") || !stackTrace[0].getMethodName().equals("getCallerClass")) { throw new RuntimeException("Unexpected error: " + e.getMessage(), e); } diff --git a/jdk/test/sun/reflect/Reflection/GetCallerClassTest.sh b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.sh similarity index 90% rename from jdk/test/sun/reflect/Reflection/GetCallerClassTest.sh rename to jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.sh index b6d0ddad6f6..e2aa6f9f8d9 100644 --- a/jdk/test/sun/reflect/Reflection/GetCallerClassTest.sh +++ b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassTest.sh @@ -23,8 +23,8 @@ # @test # @bug 8010117 -# @summary Test if the VM enforces sun.reflect.Reflection.getCallerClass -# be called by methods annotated with sun.reflect.CallerSensitive +# @summary Test if the VM enforces Reflection.getCallerClass +# be called by methods annotated with CallerSensitive # # @run shell GetCallerClassTest.sh @@ -55,7 +55,7 @@ BCP=${TESTCLASSES}/bcp rm -rf ${BCP} mkdir ${BCP} -EXTRAOPTS="-XaddExports:java.base/sun.reflect=ALL-UNNAMED" +EXTRAOPTS="-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED" # Compile GetCallerClass in bootclasspath ${COMPILEJAVA}/bin/javac ${TESTTOOLVMOPTS} ${EXTRAOPTS} \ diff --git a/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java new file mode 100644 index 00000000000..c220db3f432 --- /dev/null +++ b/jdk/test/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8025799 + * @summary Reflection.getCallerClass(int) + * @modules java.base/jdk.internal.reflect + * @run main GetCallerClassWithDepth + */ + +import jdk.internal.reflect.Reflection; + +public class GetCallerClassWithDepth { + public static void main(String[] args) throws Exception { + Class c = Test.test(); + assertEquals(c, GetCallerClassWithDepth.class); + Class caller = Test.caller(); + assertEquals(caller, GetCallerClassWithDepth.class); + Test.selfTest(); + + try { + Reflection.getCallerClass(-1); + throw new RuntimeException("getCallerClass(-1) should fail"); + } catch (Error e) { + System.out.println("Expected: " + e.getMessage()); + } + } + + public Class getCallerClass() { + // 0: Reflection 1: getCallerClass 2: Test.test 3: main + return Reflection.getCallerClass(3); + } + + static void assertEquals(Class c, Class expected) { + if (c != expected) { + throw new RuntimeException("Incorrect caller: " + c); + } + } + + static class Test { + // Returns the caller of this method + public static Class test() { + return new GetCallerClassWithDepth().getCallerClass(); + } + + // Returns the caller of this method + public static Class caller() { + // 0: Reflection 1: Test.caller 2: main + return Reflection.getCallerClass(2); + } + public static void selfTest() { + // 0: Reflection 1: Test.selfTest + Class c = Reflection.getCallerClass(1); + assertEquals(c, Test.class); + Inner1.deep(); + } + + static class Inner1 { + static void deep() { + deeper(); + } + static void deeper() { + Inner2.deepest(); + } + static class Inner2 { + static void deepest() { + // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest + Class c = Reflection.getCallerClass(4); + assertEquals(c, Test.class); + } + } + } + } +} diff --git a/jdk/test/sun/reflect/constantPool/ConstantPoolTest.java b/jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTest.java similarity index 96% rename from jdk/test/sun/reflect/constantPool/ConstantPoolTest.java rename to jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTest.java index fab27c6fe91..1ab4573ea00 100644 --- a/jdk/test/sun/reflect/constantPool/ConstantPoolTest.java +++ b/jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTest.java @@ -24,21 +24,21 @@ /* * @test * @bug 8141615 - * @summary Tests new public methods at sun.reflect.ConstantPool + * @summary Tests new public methods at ConstantPool * @modules java.base/jdk.internal.misc - * java.base/sun.reflect + * java.base/jdk.internal.reflect * @library /lib/testlibrary * @compile ConstantPoolTestDummy.jasm - * @run main sun.reflect.constantPool.ConstantPoolTest + * @run main jdk.internal.reflect.constantPool.ConstantPoolTest */ -package sun.reflect.constantPool; +package jdk.internal.reflect.constantPool; import java.util.HashMap; import java.util.Map; import jdk.internal.misc.SharedSecrets; import jdk.testlibrary.Asserts; -import sun.reflect.ConstantPool; +import jdk.internal.reflect.ConstantPool; public class ConstantPoolTest { diff --git a/jdk/test/sun/reflect/constantPool/ConstantPoolTestDummy.jasm b/jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTestDummy.jasm similarity index 95% rename from jdk/test/sun/reflect/constantPool/ConstantPoolTestDummy.jasm rename to jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTestDummy.jasm index cb3daaff8c9..3884f1644ff 100644 --- a/jdk/test/sun/reflect/constantPool/ConstantPoolTestDummy.jasm +++ b/jdk/test/jdk/internal/reflect/constantPool/ConstantPoolTestDummy.jasm @@ -21,7 +21,7 @@ * questions. */ -package sun/reflect/constantPool; +package jdk/internal/reflect/constantPool; super public #2; //class ConstantPoolTestDummy version 52:0 @@ -41,7 +41,7 @@ const #7 = Asciz "LineNumberTable"; const #8 = Asciz "SourceFile"; const #9 = Asciz "ConstantPoolTestDummy.java"; const #10 = NameAndType #4:#5; // "":"()V" -const #11 = Asciz "sun/reflect/constantPool/ConstantPoolTestDummy"; +const #11 = Asciz "jdk/internal/reflect/constantPool/ConstantPoolTestDummy"; const #12 = Asciz "java/lang/Object"; const #13 = long 6l; const #15 = int 1; @@ -76,7 +76,7 @@ const #44 = Asciz "Lookup"; const #45 = class #47; // java/lang/invoke/MethodHandles const #46 = Asciz "java/lang/invoke/MethodHandles$Lookup"; const #47 = Asciz "java/lang/invoke/MethodHandles"; -const #48 = Field #2.#49; // sun/reflect/constantPool/ConstantPoolTestDummy.myField:"I" +const #48 = Field #2.#49; // jdk/internal/reflect/constantPool/ConstantPoolTestDummy.myField:"I" const #49 = NameAndType #50:#51; // myField:"I" const #50 = Asciz "myField"; const #51 = Asciz "I"; diff --git a/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java index 8e7c9cc9d13..1b2650d8543 100644 --- a/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java +++ b/jdk/test/sun/reflect/Reflection/GetCallerClassWithDepth.java @@ -23,12 +23,13 @@ /* * @test - * @bug 8025799 - * @summary sun.reflect.Reflection.getCallerClass(int) - * @modules java.base/sun.reflect - * @run main GetCallerClassWithDepth + * @bug 8137058 + * @summary Basic test for the unsupported Reflection.getCallerClass(int) + * @modules jdk.unsupported */ +import sun.reflect.Reflection; + public class GetCallerClassWithDepth { public static void main(String[] args) throws Exception { Class c = Test.test(); @@ -38,7 +39,7 @@ public class GetCallerClassWithDepth { Test.selfTest(); try { - sun.reflect.Reflection.getCallerClass(-1); + Reflection.getCallerClass(-1); throw new RuntimeException("getCallerClass(-1) should fail"); } catch (Error e) { System.out.println("Expected: " + e.getMessage()); @@ -47,7 +48,7 @@ public class GetCallerClassWithDepth { public Class getCallerClass() { // 0: Reflection 1: getCallerClass 2: Test.test 3: main - return sun.reflect.Reflection.getCallerClass(3); + return Reflection.getCallerClass(3); } static void assertEquals(Class c, Class expected) { @@ -65,11 +66,11 @@ public class GetCallerClassWithDepth { // Returns the caller of this method public static Class caller() { // 0: Reflection 1: Test.caller 2: main - return sun.reflect.Reflection.getCallerClass(2); + return Reflection.getCallerClass(2); } public static void selfTest() { // 0: Reflection 1: Test.selfTest - Class c = sun.reflect.Reflection.getCallerClass(1); + Class c = Reflection.getCallerClass(1); assertEquals(c, Test.class); Inner1.deep(); } @@ -84,7 +85,7 @@ public class GetCallerClassWithDepth { static class Inner2 { static void deepest() { // 0: Reflection 1: deepest 2: deeper 3: deep 4: Test.selfTest - Class c = sun.reflect.Reflection.getCallerClass(4); + Class c = Reflection.getCallerClass(4); assertEquals(c, Test.class); } } diff --git a/jdk/test/sun/reflect/ReflectionFactory/NewConstructorForSerialization.java b/jdk/test/sun/reflect/ReflectionFactory/NewConstructorForSerialization.java new file mode 100644 index 00000000000..377cf10d6e1 --- /dev/null +++ b/jdk/test/sun/reflect/ReflectionFactory/NewConstructorForSerialization.java @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +/* + * @test + * @bug 8137058 + * @summary Basic test for the unsupported newConstructorForSerialization + * @modules jdk.unsupported + */ + +import java.lang.reflect.Constructor; +import sun.reflect.ReflectionFactory; + +public class NewConstructorForSerialization { + + private static Constructor getConstructor(Class type) + throws NoSuchMethodException + { + ReflectionFactory factory = ReflectionFactory.getReflectionFactory(); + Constructor objectConstructor = type.getConstructor((Class[]) null); + + @SuppressWarnings("unchecked") + Constructor c = (Constructor) factory + .newConstructorForSerialization(type, objectConstructor); + return c; + } + + public static void main(String[] args) throws Exception { + System.out.println(getConstructor(Object.class).newInstance()); + System.out.println(getConstructor(Foo.class).newInstance()); + System.out.println(getConstructor(Bar.class).newInstance()); + } + + static class Foo { + public Foo() { } + } + + static class Bar extends Foo { + public Bar() { } + } +} diff --git a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java index fcb693c6285..414e0d99f1e 100644 --- a/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java +++ b/jdk/test/tools/launcher/modules/addexports/AddExportsTest.java @@ -107,7 +107,7 @@ public class AddExportsTest { public void testSanity() throws Exception { int exitValue - = executeTestJava("-XaddExports:java.base/sun.reflect=ALL-UNNAMED", + = executeTestJava("-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED", "-version") .outputTo(System.out) .errorTo(System.out) @@ -207,8 +207,8 @@ public class AddExportsTest { public void testWithDuplicateOption() throws Exception { int exitValue - = executeTestJava("-XaddExports:java.base/sun.reflect=ALL-UNNAMED", - "-XaddExports:java.base/sun.reflect=ALL-UNNAMED", + = executeTestJava("-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED", + "-XaddExports:java.base/jdk.internal.reflect=ALL-UNNAMED", "-version") .outputTo(System.out) .errorTo(System.out)