changeset 14176:8606d027b2c2

8137058: Clear out all non-Critical APIs from sun.reflect Reviewed-by: alanb, jfranck, mchung
author chegar
date Fri, 15 Apr 2016 16:19:15 +0100
parents 59f9a8d7b718
children 6512923d64e5
files make/mapfiles/libjava/mapfile-vers src/java.base/share/classes/java/io/ObjectStreamClass.java src/java.base/share/classes/java/io/ObjectStreamField.java src/java.base/share/classes/java/lang/Class.java src/java.base/share/classes/java/lang/ClassLoader.java src/java.base/share/classes/java/lang/Package.java src/java.base/share/classes/java/lang/Runtime.java src/java.base/share/classes/java/lang/SecurityManager.java src/java.base/share/classes/java/lang/StackStreamFactory.java src/java.base/share/classes/java/lang/StackWalker.java src/java.base/share/classes/java/lang/System.java src/java.base/share/classes/java/lang/Thread.java src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java src/java.base/share/classes/java/lang/invoke/MethodHandles.java src/java.base/share/classes/java/lang/reflect/AccessibleObject.java src/java.base/share/classes/java/lang/reflect/Constructor.java src/java.base/share/classes/java/lang/reflect/Field.java src/java.base/share/classes/java/lang/reflect/Method.java src/java.base/share/classes/java/lang/reflect/Modifier.java src/java.base/share/classes/java/lang/reflect/Module.java src/java.base/share/classes/java/lang/reflect/Proxy.java src/java.base/share/classes/java/lang/reflect/ReflectAccess.java src/java.base/share/classes/java/net/InetAddress.java src/java.base/share/classes/java/security/AccessController.java src/java.base/share/classes/java/util/ResourceBundle.java src/java.base/share/classes/java/util/ServiceLoader.java src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java src/java.base/share/classes/jdk/internal/misc/Unsafe.java src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java src/java.base/share/classes/jdk/internal/reflect/BootstrapConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/ByteVector.java src/java.base/share/classes/jdk/internal/reflect/ByteVectorFactory.java src/java.base/share/classes/jdk/internal/reflect/ByteVectorImpl.java src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java src/java.base/share/classes/jdk/internal/reflect/ClassFileConstants.java src/java.base/share/classes/jdk/internal/reflect/ConstantPool.java src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessor.java src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/DelegatingConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/FieldAccessor.java src/java.base/share/classes/jdk/internal/reflect/FieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/InstantiationExceptionConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/Label.java src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java src/java.base/share/classes/jdk/internal/reflect/MagicAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/MethodAccessor.java src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java src/java.base/share/classes/jdk/internal/reflect/MethodAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/Reflection.java src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java src/java.base/share/classes/jdk/internal/reflect/SerializationConstructorAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/SignatureIterator.java src/java.base/share/classes/jdk/internal/reflect/UTF8.java src/java.base/share/classes/jdk/internal/reflect/UnsafeBooleanFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeByteFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeCharacterFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeDoubleFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeFloatFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeIntegerFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeLongFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedByteFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedLongFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedShortFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeShortFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticByteFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticFloatFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticLongFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticObjectFieldAccessorImpl.java src/java.base/share/classes/jdk/internal/reflect/UnsafeStaticShortFieldAccessorImpl.java src/java.base/share/classes/module-info.java src/java.base/share/classes/sun/invoke/util/VerifyAccess.java src/java.base/share/classes/sun/reflect/AccessorGenerator.java src/java.base/share/classes/sun/reflect/BootstrapConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/ByteVector.java src/java.base/share/classes/sun/reflect/ByteVectorFactory.java src/java.base/share/classes/sun/reflect/ByteVectorImpl.java src/java.base/share/classes/sun/reflect/CallerSensitive.java src/java.base/share/classes/sun/reflect/ClassDefiner.java src/java.base/share/classes/sun/reflect/ClassFileAssembler.java src/java.base/share/classes/sun/reflect/ClassFileConstants.java src/java.base/share/classes/sun/reflect/ConstantPool.java src/java.base/share/classes/sun/reflect/ConstructorAccessor.java src/java.base/share/classes/sun/reflect/ConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/DelegatingConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/DelegatingMethodAccessorImpl.java src/java.base/share/classes/sun/reflect/FieldAccessor.java src/java.base/share/classes/sun/reflect/FieldAccessorImpl.java src/java.base/share/classes/sun/reflect/FieldInfo.java src/java.base/share/classes/sun/reflect/InstantiationExceptionConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/Label.java src/java.base/share/classes/sun/reflect/LangReflectAccess.java src/java.base/share/classes/sun/reflect/MagicAccessorImpl.java src/java.base/share/classes/sun/reflect/MethodAccessor.java src/java.base/share/classes/sun/reflect/MethodAccessorGenerator.java src/java.base/share/classes/sun/reflect/MethodAccessorImpl.java src/java.base/share/classes/sun/reflect/NativeConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/NativeMethodAccessorImpl.java src/java.base/share/classes/sun/reflect/Reflection.java src/java.base/share/classes/sun/reflect/ReflectionFactory.java src/java.base/share/classes/sun/reflect/SerializationConstructorAccessorImpl.java src/java.base/share/classes/sun/reflect/SignatureIterator.java src/java.base/share/classes/sun/reflect/UTF8.java src/java.base/share/classes/sun/reflect/UnsafeBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorFactory.java src/java.base/share/classes/sun/reflect/UnsafeFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticBooleanFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticByteFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticCharacterFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticDoubleFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticFloatFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticIntegerFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticLongFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticObjectFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/UnsafeStaticShortFieldAccessorImpl.java src/java.base/share/classes/sun/reflect/annotation/AnnotationParser.java src/java.base/share/classes/sun/reflect/annotation/AnnotationSupport.java src/java.base/share/classes/sun/reflect/annotation/TypeAnnotationParser.java src/java.base/share/classes/sun/reflect/misc/ReflectUtil.java src/java.base/share/native/libjava/Class.c src/java.base/share/native/libjava/ConstantPool.c src/java.base/share/native/libjava/NativeAccessors.c src/java.base/share/native/libjava/Reflection.c src/java.logging/share/classes/java/util/logging/Logger.java src/java.sql.rowset/share/classes/javax/sql/rowset/serial/SerialJavaObject.java src/java.sql/share/classes/java/sql/DriverManager.java src/jdk.unsupported/share/classes/module-info.java src/jdk.unsupported/share/classes/sun/misc/Unsafe.java src/jdk.unsupported/share/classes/sun/reflect/Reflection.java src/jdk.unsupported/share/classes/sun/reflect/ReflectionFactory.java test/TEST.groups test/java/lang/StackWalker/DumpStackTest.java test/java/lang/StackWalker/EmbeddedStackWalkTest.java test/java/lang/StackWalker/HiddenFrames.java test/java/lang/StackWalker/MultiThreadStackWalk.java test/java/lang/StackWalker/StackWalkTest.java test/java/lang/StackWalker/VerifyStackTrace.java test/java/lang/invoke/RevealDirectTest.java test/jdk/internal/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java test/jdk/internal/reflect/CallerSensitive/CallerSensitiveFinder.java test/jdk/internal/reflect/CallerSensitive/MissingCallerSensitive.java test/jdk/internal/reflect/Reflection/GetCallerClass.java test/jdk/internal/reflect/Reflection/GetCallerClassTest.java test/jdk/internal/reflect/Reflection/GetCallerClassTest.sh test/jdk/internal/reflect/Reflection/GetCallerClassWithDepth.java test/jdk/internal/reflect/constantPool/ConstantPoolTest.java test/jdk/internal/reflect/constantPool/ConstantPoolTestDummy.jasm test/sun/reflect/AnonymousNewInstance/ManyNewInstanceAnonTest.java test/sun/reflect/CallerSensitive/CallerSensitiveFinder.java test/sun/reflect/CallerSensitive/MissingCallerSensitive.java test/sun/reflect/Reflection/GetCallerClass.java test/sun/reflect/Reflection/GetCallerClassTest.java test/sun/reflect/Reflection/GetCallerClassTest.sh test/sun/reflect/Reflection/GetCallerClassWithDepth.java test/sun/reflect/ReflectionFactory/NewConstructorForSerialization.java test/sun/reflect/constantPool/ConstantPoolTest.java test/sun/reflect/constantPool/ConstantPoolTestDummy.jasm test/tools/launcher/modules/addexports/AddExportsTest.java
diffstat 220 files changed, 11872 insertions(+), 11648 deletions(-) [+]
line wrap: on
line diff
--- a/make/mapfiles/libjava/mapfile-vers	Fri Apr 15 14:29:02 2016 +0100
+++ b/make/mapfiles/libjava/mapfile-vers	Fri Apr 15 16:19:15 2016 +0100
@@ -237,32 +237,32 @@
 		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;
--- a/src/java.base/share/classes/java/io/ObjectStreamClass.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java	Fri Apr 15 16:19:15 2016 +0100
@@ -49,9 +49,9 @@
 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.*;
--- a/src/java.base/share/classes/java/io/ObjectStreamField.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/io/ObjectStreamField.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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;
 
 /**
--- a/src/java.base/share/classes/java/lang/Class.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/Class.java	Fri Apr 15 16:19:15 2016 +0100
@@ -66,10 +66,10 @@
 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 @@
         if (reflectionFactory == null) {
             reflectionFactory =
                 java.security.AccessController.doPrivileged
-                    (new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
+                    (new ReflectionFactory.GetReflectionFactoryAction());
         }
         return reflectionFactory;
     }
--- a/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/ClassLoader.java	Fri Apr 15 16:19:15 2016 +0100
@@ -60,8 +60,8 @@
 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;
 
--- a/src/java.base/share/classes/java/lang/Package.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/Package.java	Fri Apr 15 16:19:15 2016 +0100
@@ -36,8 +36,8 @@
 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;
 
 
 /**
--- a/src/java.base/share/classes/java/lang/Runtime.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/Runtime.java	Fri Apr 15 16:19:15 2016 +0100
@@ -27,8 +27,8 @@
 
 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
--- a/src/java.base/share/classes/java/lang/SecurityManager.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/SecurityManager.java	Fri Apr 15 16:19:15 2016 +0100
@@ -38,7 +38,7 @@
 import java.lang.reflect.*;
 import java.net.URL;
 
-import sun.reflect.CallerSensitive;
+import jdk.internal.reflect.CallerSensitive;
 import sun.security.util.SecurityConstants;
 
 /**
--- a/src/java.base/share/classes/java/lang/StackStreamFactory.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/StackStreamFactory.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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 @@
     }
 
     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");
     }
 
--- a/src/java.base/share/classes/java/lang/StackWalker.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/StackWalker.java	Fri Apr 15 16:19:15 2016 +0100
@@ -24,7 +24,7 @@
  */
 package java.lang;
 
-import sun.reflect.CallerSensitive;
+import jdk.internal.reflect.CallerSensitive;
 
 import java.util.*;
 import java.util.function.Consumer;
--- a/src/java.base/share/classes/java/lang/System.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/System.java	Fri Apr 15 16:19:15 2016 +0100
@@ -56,8 +56,8 @@
 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 @@
     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) {
--- a/src/java.base/share/classes/java/lang/Thread.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/Thread.java	Fri Apr 15 16:19:15 2016 +0100
@@ -37,8 +37,8 @@
 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;
 
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -33,13 +33,13 @@
 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;
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleProxies.java	Fri Apr 15 16:19:15 2016 +0100
@@ -30,8 +30,8 @@
 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.*;
 
--- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java	Fri Apr 15 16:19:15 2016 +0100
@@ -37,8 +37,8 @@
 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;
--- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java	Fri Apr 15 16:19:15 2016 +0100
@@ -27,9 +27,9 @@
 
 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 @@
     // very early in the bootstrapping process.
     static final ReflectionFactory reflectionFactory =
         AccessController.doPrivileged(
-            new sun.reflect.ReflectionFactory.GetReflectionFactoryAction());
+            new ReflectionFactory.GetReflectionFactoryAction());
 
     /**
      * @throws NullPointerException {@inheritDoc}
--- a/src/java.base/share/classes/java/lang/reflect/Constructor.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Constructor.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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;
--- a/src/java.base/share/classes/java/lang/reflect/Field.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Field.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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;
--- a/src/java.base/share/classes/java/lang/reflect/Method.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Method.java	Fri Apr 15 16:19:15 2016 +0100
@@ -27,9 +27,9 @@
 
 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;
--- a/src/java.base/share/classes/java/lang/reflect/Modifier.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Modifier.java	Fri Apr 15 16:19:15 2016 +0100
@@ -27,8 +27,8 @@
 
 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 @@
      *  packages
      */
     static {
-        sun.reflect.ReflectionFactory factory =
-            AccessController.doPrivileged(
+        ReflectionFactory factory = AccessController.doPrivileged(
                 new ReflectionFactory.GetReflectionFactoryAction());
         factory.setLangReflectAccess(new java.lang.reflect.ReflectAccess());
     }
--- a/src/java.base/share/classes/java/lang/reflect/Module.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Module.java	Fri Apr 15 16:19:15 2016 +0100
@@ -56,8 +56,8 @@
 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;
 
 /**
--- a/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/Proxy.java	Fri Apr 15 16:19:15 2016 +0100
@@ -47,8 +47,8 @@
 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;
 
--- a/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/lang/reflect/ReflectAccess.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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,
--- a/src/java.base/share/classes/java/net/InetAddress.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/net/InetAddress.java	Fri Apr 15 16:19:15 2016 +0100
@@ -894,19 +894,17 @@
      */
     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 @@
             return host;
         }
 
-
         /**
          * <p>Lookup a host mapping by name. Retrieve the IP addresses
          * associated with a host.
@@ -1004,7 +1001,6 @@
          * @throws UnknownHostException
          *             if no IP address for the {@code host} could be found
          */
-
         public InetAddress[] lookupAllHostAddr(String host)
                 throws UnknownHostException {
             String hostEntry;
--- a/src/java.base/share/classes/java/security/AccessController.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/security/AccessController.java	Fri Apr 15 16:19:15 2016 +0100
@@ -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;
 
 /**
  * <p> The AccessController class is used for access control operations
--- a/src/java.base/share/classes/java/util/ResourceBundle.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/util/ResourceBundle.java	Fri Apr 15 16:19:15 2016 +0100
@@ -64,8 +64,8 @@
 
 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;
--- a/src/java.base/share/classes/java/util/ServiceLoader.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/util/ServiceLoader.java	Fri Apr 15 16:19:15 2016 +0100
@@ -51,8 +51,8 @@
 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;
 
 
 /**
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicIntegerFieldUpdater.java	Fri Apr 15 16:19:15 2016 +0100
@@ -42,8 +42,8 @@
 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
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicLongFieldUpdater.java	Fri Apr 15 16:19:15 2016 +0100
@@ -42,8 +42,8 @@
 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
--- a/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java	Fri Apr 15 16:19:15 2016 +0100
@@ -42,8 +42,8 @@
 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
--- a/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaLangAccess.java	Fri Apr 15 16:19:15 2016 +0100
@@ -37,7 +37,7 @@
 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;
 
--- a/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Apr 15 14:29:02 2016 +0100
+++ b/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Apr 15 16:19:15 2016 +0100
@@ -28,8 +28,8 @@
 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 @@
     private static native void registerNatives();
     static {
         registerNatives();
-        sun.reflect.Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
+        Reflection.registerMethodsToFilter(Unsafe.class, "getUnsafe");
     }
 
     private Unsafe() {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/AccessorGenerator.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,723 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.lang.reflect.*;
+import jdk.internal.misc.Unsafe;
+
+/** Shared functionality for all accessor generators */
+
+class AccessorGenerator implements ClassFileConstants {
+    static final Unsafe unsafe = Unsafe.getUnsafe();
+
+    // Constants because there's no way to say "short integer constant",
+    // i.e., "1S"
+    protected static final short S0 = (short) 0;
+    protected static final short S1 = (short) 1;
+    protected static final short S2 = (short) 2;
+    protected static final short S3 = (short) 3;
+    protected static final short S4 = (short) 4;
+    protected static final short S5 = (short) 5;
+    protected static final short S6 = (short) 6;
+
+    // Instance variables for shared functionality between
+    // FieldAccessorGenerator and MethodAccessorGenerator
+    protected ClassFileAssembler asm;
+    protected int   modifiers;
+    protected short thisClass;
+    protected short superClass;
+    protected short targetClass;
+    // Common constant pool entries to FieldAccessor and MethodAccessor
+    protected short throwableClass;
+    protected short classCastClass;
+    protected short nullPointerClass;
+    protected short illegalArgumentClass;
+    protected short invocationTargetClass;
+    protected short initIdx;
+    protected short initNameAndTypeIdx;
+    protected short initStringNameAndTypeIdx;
+    protected short nullPointerCtorIdx;
+    protected short illegalArgumentCtorIdx;
+    protected short illegalArgumentStringCtorIdx;
+    protected short invocationTargetCtorIdx;
+    protected short superCtorIdx;
+    protected short objectClass;
+    protected short toStringIdx;
+    protected short codeIdx;
+    protected short exceptionsIdx;
+    // Boxing
+    protected short valueOfIdx;
+    protected short booleanIdx;
+    protected short booleanBoxIdx;
+    protected short booleanUnboxIdx;
+    protected short byteIdx;
+    protected short byteBoxIdx;
+    protected short byteUnboxIdx;
+    protected short characterIdx;
+    protected short characterBoxIdx;
+    protected short characterUnboxIdx;
+    protected short doubleIdx;
+    protected short doubleBoxIdx;
+    protected short doubleUnboxIdx;
+    protected short floatIdx;
+    protected short floatBoxIdx;
+    protected short floatUnboxIdx;
+    protected short integerIdx;
+    protected short integerBoxIdx;
+    protected short integerUnboxIdx;
+    protected short longIdx;
+    protected short longBoxIdx;
+    protected short longUnboxIdx;
+    protected short shortIdx;
+    protected short shortBoxIdx;
+    protected short shortUnboxIdx;
+
+    protected final short NUM_COMMON_CPOOL_ENTRIES = (short) 30;
+    protected final short NUM_BOXING_CPOOL_ENTRIES = (short) 73;
+
+    // Requires that superClass has been set up
+    protected void emitCommonConstantPoolEntries() {
+        // +   [UTF-8] "java/lang/Throwable"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/ClassCastException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/NullPointerException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/IllegalArgumentException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/InvocationTargetException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "<init>"
+        // +   [UTF-8] "()V"
+        // +   [CONSTANT_NameAndType_info] for above
+        // +   [CONSTANT_Methodref_info] for NullPointerException's constructor
+        // +   [CONSTANT_Methodref_info] for IllegalArgumentException's constructor
+        // +   [UTF-8] "(Ljava/lang/String;)V"
+        // +   [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/String;)V"
+        // +   [CONSTANT_Methodref_info] for IllegalArgumentException's constructor taking a String
+        // +   [UTF-8] "(Ljava/lang/Throwable;)V"
+        // +   [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/Throwable;)V"
+        // +   [CONSTANT_Methodref_info] for InvocationTargetException's constructor
+        // +   [CONSTANT_Methodref_info] for "super()"
+        // +   [UTF-8] "java/lang/Object"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "toString"
+        // +   [UTF-8] "()Ljava/lang/String;"
+        // +   [CONSTANT_NameAndType_info] for "toString()Ljava/lang/String;"
+        // +   [CONSTANT_Methodref_info] for Object's toString method
+        // +   [UTF-8] "Code"
+        // +   [UTF-8] "Exceptions"
+        asm.emitConstantPoolUTF8("java/lang/Throwable");
+        asm.emitConstantPoolClass(asm.cpi());
+        throwableClass = asm.cpi();
+        asm.emitConstantPoolUTF8("java/lang/ClassCastException");
+        asm.emitConstantPoolClass(asm.cpi());
+        classCastClass = asm.cpi();
+        asm.emitConstantPoolUTF8("java/lang/NullPointerException");
+        asm.emitConstantPoolClass(asm.cpi());
+        nullPointerClass = asm.cpi();
+        asm.emitConstantPoolUTF8("java/lang/IllegalArgumentException");
+        asm.emitConstantPoolClass(asm.cpi());
+        illegalArgumentClass = asm.cpi();
+        asm.emitConstantPoolUTF8("java/lang/reflect/InvocationTargetException");
+        asm.emitConstantPoolClass(asm.cpi());
+        invocationTargetClass = asm.cpi();
+        asm.emitConstantPoolUTF8("<init>");
+        initIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("()V");
+        asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+        initNameAndTypeIdx = asm.cpi();
+        asm.emitConstantPoolMethodref(nullPointerClass, initNameAndTypeIdx);
+        nullPointerCtorIdx = asm.cpi();
+        asm.emitConstantPoolMethodref(illegalArgumentClass, initNameAndTypeIdx);
+        illegalArgumentCtorIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(Ljava/lang/String;)V");
+        asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+        initStringNameAndTypeIdx = asm.cpi();
+        asm.emitConstantPoolMethodref(illegalArgumentClass, initStringNameAndTypeIdx);
+        illegalArgumentStringCtorIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(Ljava/lang/Throwable;)V");
+        asm.emitConstantPoolNameAndType(initIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(invocationTargetClass, asm.cpi());
+        invocationTargetCtorIdx = asm.cpi();
+        asm.emitConstantPoolMethodref(superClass, initNameAndTypeIdx);
+        superCtorIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("java/lang/Object");
+        asm.emitConstantPoolClass(asm.cpi());
+        objectClass = asm.cpi();
+        asm.emitConstantPoolUTF8("toString");
+        asm.emitConstantPoolUTF8("()Ljava/lang/String;");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(objectClass, asm.cpi());
+        toStringIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("Code");
+        codeIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("Exceptions");
+        exceptionsIdx = asm.cpi();
+    }
+
+    /** Constant pool entries required to be able to box/unbox primitive
+        types. Note that we don't emit these if we don't need them. */
+    protected void emitBoxingContantPoolEntries() {
+        //  *  [UTF-8] "valueOf"
+        //  *  [UTF-8] "java/lang/Boolean"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(Z)Ljava/lang/Boolean;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "booleanValue"
+        //  *  [UTF-8] "()Z"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Byte"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(B)Ljava/lang/Byte;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "byteValue"
+        //  *  [UTF-8] "()B"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Character"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(C)Ljava/lang/Character;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "charValue"
+        //  *  [UTF-8] "()C"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Double"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(D)Ljava/lang/Double;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "doubleValue"
+        //  *  [UTF-8] "()D"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Float"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(F)Ljava/lang/Float;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "floatValue"
+        //  *  [UTF-8] "()F"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Integer"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(I)Ljava/lang/Integer;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "intValue"
+        //  *  [UTF-8] "()I"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Long"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(J)Ljava/lang/Long;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "longValue"
+        //  *  [UTF-8] "()J"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Short"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(S)Ljava/lang/Short;"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "shortValue"
+        //  *  [UTF-8] "()S"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+
+        // valueOf-method name
+        asm.emitConstantPoolUTF8("valueOf");
+        valueOfIdx = asm.cpi();
+
+        // Boolean
+        asm.emitConstantPoolUTF8("java/lang/Boolean");
+        asm.emitConstantPoolClass(asm.cpi());
+        booleanIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(Z)Ljava/lang/Boolean;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        booleanBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("booleanValue");
+        asm.emitConstantPoolUTF8("()Z");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        booleanUnboxIdx = asm.cpi();
+
+        // Byte
+        asm.emitConstantPoolUTF8("java/lang/Byte");
+        asm.emitConstantPoolClass(asm.cpi());
+        byteIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(B)Ljava/lang/Byte;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        byteBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("byteValue");
+        asm.emitConstantPoolUTF8("()B");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        byteUnboxIdx = asm.cpi();
+
+        // Character
+        asm.emitConstantPoolUTF8("java/lang/Character");
+        asm.emitConstantPoolClass(asm.cpi());
+        characterIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(C)Ljava/lang/Character;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        characterBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("charValue");
+        asm.emitConstantPoolUTF8("()C");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        characterUnboxIdx = asm.cpi();
+
+        // Double
+        asm.emitConstantPoolUTF8("java/lang/Double");
+        asm.emitConstantPoolClass(asm.cpi());
+        doubleIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(D)Ljava/lang/Double;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        doubleBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("doubleValue");
+        asm.emitConstantPoolUTF8("()D");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        doubleUnboxIdx = asm.cpi();
+
+        // Float
+        asm.emitConstantPoolUTF8("java/lang/Float");
+        asm.emitConstantPoolClass(asm.cpi());
+        floatIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(F)Ljava/lang/Float;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        floatBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("floatValue");
+        asm.emitConstantPoolUTF8("()F");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        floatUnboxIdx = asm.cpi();
+
+        // Integer
+        asm.emitConstantPoolUTF8("java/lang/Integer");
+        asm.emitConstantPoolClass(asm.cpi());
+        integerIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(I)Ljava/lang/Integer;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        integerBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("intValue");
+        asm.emitConstantPoolUTF8("()I");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        integerUnboxIdx = asm.cpi();
+
+        // Long
+        asm.emitConstantPoolUTF8("java/lang/Long");
+        asm.emitConstantPoolClass(asm.cpi());
+        longIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(J)Ljava/lang/Long;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        longBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("longValue");
+        asm.emitConstantPoolUTF8("()J");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        longUnboxIdx = asm.cpi();
+
+        // Short
+        asm.emitConstantPoolUTF8("java/lang/Short");
+        asm.emitConstantPoolClass(asm.cpi());
+        shortIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("(S)Ljava/lang/Short;");
+        asm.emitConstantPoolNameAndType(valueOfIdx, asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S2), asm.cpi());
+        shortBoxIdx = asm.cpi();
+        asm.emitConstantPoolUTF8("shortValue");
+        asm.emitConstantPoolUTF8("()S");
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        asm.emitConstantPoolMethodref(sub(asm.cpi(), S6), asm.cpi());
+        shortUnboxIdx = asm.cpi();
+    }
+
+    // Necessary because of Java's annoying promotion rules
+    protected static short add(short s1, short s2) {
+        return (short) (s1 + s2);
+    }
+
+    protected static short sub(short s1, short s2) {
+        return (short) (s1 - s2);
+    }
+
+    protected boolean isStatic() {
+        return Modifier.isStatic(modifiers);
+    }
+
+    protected boolean isPrivate() {
+        return Modifier.isPrivate(modifiers);
+    }
+
+    /** Returns class name in "internal" form (i.e., '/' separators
+        instead of '.') */
+    protected static String getClassName
+        (Class<?> c, boolean addPrefixAndSuffixForNonPrimitiveTypes)
+    {
+        if (c.isPrimitive()) {
+            if (c == Boolean.TYPE) {
+                return "Z";
+            } else if (c == Byte.TYPE) {
+                return "B";
+            } else if (c == Character.TYPE) {
+                return "C";
+            } else if (c == Double.TYPE) {
+                return "D";
+            } else if (c == Float.TYPE) {
+                return "F";
+            } else if (c == Integer.TYPE) {
+                return "I";
+            } else if (c == Long.TYPE) {
+                return "J";
+            } else if (c == Short.TYPE) {
+                return "S";
+            } else if (c == Void.TYPE) {
+                return "V";
+            }
+            throw new InternalError("Should have found primitive type");
+        } else if (c.isArray()) {
+            return "[" + getClassName(c.getComponentType(), true);
+        } else {
+            if (addPrefixAndSuffixForNonPrimitiveTypes) {
+                return internalize("L" + c.getName() + ";");
+            } else {
+                return internalize(c.getName());
+            }
+        }
+    }
+
+    private static String internalize(String className) {
+        return className.replace('.', '/');
+    }
+
+    protected void emitConstructor() {
+        // Generate code into fresh code buffer
+        ClassFileAssembler cb = new ClassFileAssembler();
+        // 0 incoming arguments
+        cb.setMaxLocals(1);
+        cb.opc_aload_0();
+        cb.opc_invokespecial(superCtorIdx, 0, 0);
+        cb.opc_return();
+
+        // Emit method
+        emitMethod(initIdx, cb.getMaxLocals(), cb, null, null);
+    }
+
+    // The descriptor's index in the constant pool must be (1 +
+    // nameIdx). "numArgs" must indicate ALL arguments, including the
+    // implicit "this" argument; double and long arguments each count
+    // as 2 in this count. The code buffer must NOT contain the code
+    // length. The exception table may be null, but if non-null must
+    // NOT contain the exception table's length. The checked exception
+    // indices may be null.
+    protected void emitMethod(short nameIdx,
+                              int numArgs,
+                              ClassFileAssembler code,
+                              ClassFileAssembler exceptionTable,
+                              short[] checkedExceptionIndices)
+    {
+        int codeLen = code.getLength();
+        int excLen  = 0;
+        if (exceptionTable != null) {
+            excLen = exceptionTable.getLength();
+            if ((excLen % 8) != 0) {
+                throw new IllegalArgumentException("Illegal exception table");
+            }
+        }
+        int attrLen = 12 + codeLen + excLen;
+        excLen = excLen / 8; // No-op if no exception table
+
+        asm.emitShort(ACC_PUBLIC);
+        asm.emitShort(nameIdx);
+        asm.emitShort(add(nameIdx, S1));
+        if (checkedExceptionIndices == null) {
+            // Code attribute only
+            asm.emitShort(S1);
+        } else {
+            // Code and Exceptions attributes
+            asm.emitShort(S2);
+        }
+        // Code attribute
+        asm.emitShort(codeIdx);
+        asm.emitInt(attrLen);
+        asm.emitShort(code.getMaxStack());
+        asm.emitShort((short) Math.max(numArgs, code.getMaxLocals()));
+        asm.emitInt(codeLen);
+        asm.append(code);
+        asm.emitShort((short) excLen);
+        if (exceptionTable != null) {
+            asm.append(exceptionTable);
+        }
+        asm.emitShort(S0); // No additional attributes for Code attribute
+        if (checkedExceptionIndices != null) {
+            // Exceptions attribute
+            asm.emitShort(exceptionsIdx);
+            asm.emitInt(2 + 2 * checkedExceptionIndices.length);
+            asm.emitShort((short) checkedExceptionIndices.length);
+            for (int i = 0; i < checkedExceptionIndices.length; i++) {
+                asm.emitShort(checkedExceptionIndices[i]);
+            }
+        }
+    }
+
+    protected short indexForPrimitiveType(Class<?> type) {
+        if (type == Boolean.TYPE) {
+            return booleanIdx;
+        } else if (type == Byte.TYPE) {
+            return byteIdx;
+        } else if (type == Character.TYPE) {
+            return characterIdx;
+        } else if (type == Double.TYPE) {
+            return doubleIdx;
+        } else if (type == Float.TYPE) {
+            return floatIdx;
+        } else if (type == Integer.TYPE) {
+            return integerIdx;
+        } else if (type == Long.TYPE) {
+            return longIdx;
+        } else if (type == Short.TYPE) {
+            return shortIdx;
+        }
+        throw new InternalError("Should have found primitive type");
+    }
+
+    protected short boxingMethodForPrimitiveType(Class<?> type) {
+        if (type == Boolean.TYPE) {
+            return booleanBoxIdx;
+        } else if (type == Byte.TYPE) {
+            return byteBoxIdx;
+        } else if (type == Character.TYPE) {
+            return characterBoxIdx;
+        } else if (type == Double.TYPE) {
+            return doubleBoxIdx;
+        } else if (type == Float.TYPE) {
+            return floatBoxIdx;
+        } else if (type == Integer.TYPE) {
+            return integerBoxIdx;
+        } else if (type == Long.TYPE) {
+            return longBoxIdx;
+        } else if (type == Short.TYPE) {
+            return shortBoxIdx;
+        }
+        throw new InternalError("Should have found primitive type");
+    }
+
+    /** Returns true for widening or identity conversions for primitive
+        types only */
+    protected static boolean canWidenTo(Class<?> type, Class<?> otherType) {
+        if (!type.isPrimitive()) {
+            return false;
+        }
+
+        // Widening conversions (from JVM spec):
+        //  byte to short, int, long, float, or double
+        //  short to int, long, float, or double
+        //  char to int, long, float, or double
+        //  int to long, float, or double
+        //  long to float or double
+        //  float to double
+
+        if (type == Boolean.TYPE) {
+            if (otherType == Boolean.TYPE) {
+                return true;
+            }
+        } else if (type == Byte.TYPE) {
+            if (   otherType == Byte.TYPE
+                   || otherType == Short.TYPE
+                   || otherType == Integer.TYPE
+                   || otherType == Long.TYPE
+                   || otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Short.TYPE) {
+            if (   otherType == Short.TYPE
+                   || otherType == Integer.TYPE
+                   || otherType == Long.TYPE
+                   || otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Character.TYPE) {
+            if (   otherType == Character.TYPE
+                   || otherType == Integer.TYPE
+                   || otherType == Long.TYPE
+                   || otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Integer.TYPE) {
+            if (   otherType == Integer.TYPE
+                   || otherType == Long.TYPE
+                   || otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Long.TYPE) {
+            if (   otherType == Long.TYPE
+                   || otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Float.TYPE) {
+            if (   otherType == Float.TYPE
+                   || otherType == Double.TYPE) {
+                return true;
+            }
+        } else if (type == Double.TYPE) {
+            if (otherType == Double.TYPE) {
+                return true;
+            }
+        }
+
+        return false;
+    }
+
+    /** Emits the widening bytecode for the given primitive conversion
+        (or none if the identity conversion). Requires that a primitive
+        conversion exists; i.e., canWidenTo must have already been
+        called and returned true. */
+    protected static void emitWideningBytecodeForPrimitiveConversion
+        (ClassFileAssembler cb,
+         Class<?> fromType,
+         Class<?> toType)
+    {
+        // Note that widening conversions for integral types (i.e., "b2s",
+        // "s2i") are no-ops since values on the Java stack are
+        // sign-extended.
+
+        // Widening conversions (from JVM spec):
+        //  byte to short, int, long, float, or double
+        //  short to int, long, float, or double
+        //  char to int, long, float, or double
+        //  int to long, float, or double
+        //  long to float or double
+        //  float to double
+
+        if (   fromType == Byte.TYPE
+               || fromType == Short.TYPE
+               || fromType == Character.TYPE
+               || fromType == Integer.TYPE) {
+            if (toType == Long.TYPE) {
+                cb.opc_i2l();
+            } else if (toType == Float.TYPE) {
+                cb.opc_i2f();
+            } else if (toType == Double.TYPE) {
+                cb.opc_i2d();
+            }
+        } else if (fromType == Long.TYPE) {
+            if (toType == Float.TYPE) {
+                cb.opc_l2f();
+            } else if (toType == Double.TYPE) {
+                cb.opc_l2d();
+            }
+        } else if (fromType == Float.TYPE) {
+            if (toType == Double.TYPE) {
+                cb.opc_f2d();
+            }
+        }
+
+        // Otherwise, was identity or no-op conversion. Fall through.
+    }
+
+    protected short unboxingMethodForPrimitiveType(Class<?> primType) {
+        if (primType == Boolean.TYPE) {
+            return booleanUnboxIdx;
+        } else if (primType == Byte.TYPE) {
+            return byteUnboxIdx;
+        } else if (primType == Character.TYPE) {
+            return characterUnboxIdx;
+        } else if (primType == Short.TYPE) {
+            return shortUnboxIdx;
+        } else if (primType == Integer.TYPE) {
+            return integerUnboxIdx;
+        } else if (primType == Long.TYPE) {
+            return longUnboxIdx;
+        } else if (primType == Float.TYPE) {
+            return floatUnboxIdx;
+        } else if (primType == Double.TYPE) {
+            return doubleUnboxIdx;
+        }
+        throw new InternalError("Illegal primitive type " + primType.getName());
+    }
+
+    protected static final Class<?>[] primitiveTypes = new Class<?>[] {
+        Boolean.TYPE,
+        Byte.TYPE,
+        Character.TYPE,
+        Short.TYPE,
+        Integer.TYPE,
+        Long.TYPE,
+        Float.TYPE,
+        Double.TYPE
+    };
+
+    /** We don't consider "Void" to be a primitive type */
+    protected static boolean isPrimitive(Class<?> c) {
+        return (c.isPrimitive() && c != Void.TYPE);
+    }
+
+    protected int typeSizeInStackSlots(Class<?> c) {
+        if (c == Void.TYPE) {
+            return 0;
+        }
+        if (c == Long.TYPE || c == Double.TYPE) {
+            return 2;
+        }
+        return 1;
+    }
+
+    private ClassFileAssembler illegalArgumentCodeBuffer;
+    protected ClassFileAssembler illegalArgumentCodeBuffer() {
+        if (illegalArgumentCodeBuffer == null) {
+            illegalArgumentCodeBuffer = new ClassFileAssembler();
+            illegalArgumentCodeBuffer.opc_new(illegalArgumentClass);
+            illegalArgumentCodeBuffer.opc_dup();
+            illegalArgumentCodeBuffer.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+            illegalArgumentCodeBuffer.opc_athrow();
+        }
+
+        return illegalArgumentCodeBuffer;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/BootstrapConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2001, 2011, 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Constructor;
+
+/** Uses Unsafe.allocateObject() to instantiate classes; only used for
+    bootstrapping. */
+
+class BootstrapConstructorAccessorImpl extends ConstructorAccessorImpl {
+    private final Constructor<?> constructor;
+
+    BootstrapConstructorAccessorImpl(Constructor<?> c) {
+        this.constructor = c;
+    }
+
+    public Object newInstance(Object[] args)
+        throws IllegalArgumentException, InvocationTargetException
+    {
+        try {
+            return UnsafeFieldAccessorImpl.unsafe.
+                allocateInstance(constructor.getDeclaringClass());
+        } catch (InstantiationException e) {
+            throw new InvocationTargetException(e);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ByteVector.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,37 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** A growable array of bytes. */
+
+interface ByteVector {
+    public int  getLength();
+    public byte get(int index);
+    public void put(int index, byte value);
+    public void add(byte value);
+    public void trim();
+    public byte[] getData();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ByteVectorFactory.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,36 @@
+/*
+ * 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 jdk.internal.reflect;
+
+class ByteVectorFactory {
+    static ByteVector create() {
+        return new ByteVectorImpl();
+    }
+
+    static ByteVector create(int sz) {
+        return new ByteVectorImpl(sz);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ByteVectorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,88 @@
+/*
+ * 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 jdk.internal.reflect;
+
+class ByteVectorImpl implements ByteVector {
+    private byte[] data;
+    private int pos;
+
+    public ByteVectorImpl() {
+        this(100);
+    }
+
+    public ByteVectorImpl(int sz) {
+        data = new byte[sz];
+        pos = -1;
+    }
+
+    public int getLength() {
+        return pos + 1;
+    }
+
+    public byte get(int index) {
+        if (index >= data.length) {
+            resize(index);
+            pos = index;
+        }
+        return data[index];
+    }
+
+    public void put(int index, byte value) {
+        if (index >= data.length) {
+            resize(index);
+            pos = index;
+        }
+        data[index] = value;
+    }
+
+    public void add(byte value) {
+        if (++pos >= data.length) {
+            resize(pos);
+        }
+        data[pos] = value;
+    }
+
+    public void trim() {
+        if (pos != data.length - 1) {
+            byte[] newData = new byte[pos + 1];
+            System.arraycopy(data, 0, newData, 0, pos + 1);
+            data = newData;
+        }
+    }
+
+    public byte[] getData() {
+        return data;
+    }
+
+    private void resize(int minSize) {
+        if (minSize <= 2 * data.length) {
+            minSize = 2 * data.length;
+        }
+        byte[] newData = new byte[minSize];
+        System.arraycopy(data, 0, newData, 0, data.length);
+        data = newData;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/CallerSensitive.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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.  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 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 jdk.internal.reflect.Reflection#getCallerClass Reflection.getCallerClass},
+ * or via some equivalent.
+ *
+ * @author John R. Rose
+ */
+@Retention(RetentionPolicy.RUNTIME)
+@Target({METHOD})
+public @interface CallerSensitive {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ClassDefiner.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2001, 2011, 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 jdk.internal.reflect;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import jdk.internal.misc.Unsafe;
+
+/** Utility class which assists in calling Unsafe.defineClass() by
+    creating a new class loader which delegates to the one needed in
+    order for proper resolution of the given bytecodes to occur. */
+
+class ClassDefiner {
+    static final Unsafe unsafe = Unsafe.getUnsafe();
+
+    /** <P> We define generated code into a new class loader which
+      delegates to the defining loader of the target class. It is
+      necessary for the VM to be able to resolve references to the
+      target class from the generated bytecodes, which could not occur
+      if the generated code was loaded into the bootstrap class
+      loader. </P>
+
+      <P> There are two primary reasons for creating a new loader
+      instead of defining these bytecodes directly into the defining
+      loader of the target class: first, it avoids any possible
+      security risk of having these bytecodes in the same loader.
+      Second, it allows the generated bytecodes to be unloaded earlier
+      than would otherwise be possible, decreasing run-time
+      footprint. </P>
+    */
+    static Class<?> defineClass(String name, byte[] bytes, int off, int len,
+                                final ClassLoader parentClassLoader)
+    {
+        ClassLoader newLoader = AccessController.doPrivileged(
+            new PrivilegedAction<ClassLoader>() {
+                public ClassLoader run() {
+                        return new DelegatingClassLoader(parentClassLoader);
+                    }
+                });
+        return unsafe.defineClass(name, bytes, off, len, newLoader, null);
+    }
+}
+
+
+// NOTE: this class's name and presence are known to the virtual
+// machine as of the fix for 4474172.
+class DelegatingClassLoader extends ClassLoader {
+    DelegatingClassLoader(ClassLoader parent) {
+        super(parent);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ClassFileAssembler.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,671 @@
+/*
+ * Copyright (c) 2001, 2004, 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 jdk.internal.reflect;
+
+class ClassFileAssembler implements ClassFileConstants {
+    private ByteVector vec;
+    private short cpIdx = 0;
+
+    public ClassFileAssembler() {
+        this(ByteVectorFactory.create());
+    }
+
+    public ClassFileAssembler(ByteVector vec) {
+        this.vec = vec;
+    }
+
+    public ByteVector getData() {
+        return vec;
+    }
+
+    /** Length in bytes */
+    public short getLength() {
+        return (short) vec.getLength();
+    }
+
+    public void emitMagicAndVersion() {
+        emitInt(0xCAFEBABE);
+        emitShort((short) 0);
+        emitShort((short) 49);
+    }
+
+    public void emitInt(int val) {
+        emitByte((byte) (val >> 24));
+        emitByte((byte) ((val >> 16) & 0xFF));
+        emitByte((byte) ((val >> 8) & 0xFF));
+        emitByte((byte) (val & 0xFF));
+    }
+
+    public void emitShort(short val) {
+        emitByte((byte) ((val >> 8) & 0xFF));
+        emitByte((byte) (val & 0xFF));
+    }
+
+    // Support for labels; package-private
+    void emitShort(short bci, short val) {
+        vec.put(bci,     (byte) ((val >> 8) & 0xFF));
+        vec.put(bci + 1, (byte) (val & 0xFF));
+    }
+
+    public void emitByte(byte val) {
+        vec.add(val);
+    }
+
+    public void append(ClassFileAssembler asm) {
+        append(asm.vec);
+    }
+
+    public void append(ByteVector vec) {
+        for (int i = 0; i < vec.getLength(); i++) {
+            emitByte(vec.get(i));
+        }
+    }
+
+    /** Keeps track of the current (one-based) constant pool index;
+        incremented after emitting one of the following constant pool
+        entries. Can fetch the current constant pool index for use in
+        later entries.  Index points at the last valid constant pool
+        entry; initially invalid. It is illegal to fetch the constant
+        pool index before emitting at least one constant pool entry. */
+    public short cpi() {
+        if (cpIdx == 0) {
+            throw new RuntimeException("Illegal use of ClassFileAssembler");
+        }
+        return cpIdx;
+    }
+
+    public void emitConstantPoolUTF8(String str) {
+        // NOTE: can not use str.getBytes("UTF-8") here because of
+        // bootstrapping issues with the character set converters.
+        byte[] bytes = UTF8.encode(str);
+        emitByte(CONSTANT_Utf8);
+        emitShort((short) bytes.length);
+        for (int i = 0; i < bytes.length; i++) {
+            emitByte(bytes[i]);
+        }
+        cpIdx++;
+    }
+
+    public void emitConstantPoolClass(short index) {
+        emitByte(CONSTANT_Class);
+        emitShort(index);
+        cpIdx++;
+    }
+
+    public void emitConstantPoolNameAndType(short nameIndex, short typeIndex) {
+        emitByte(CONSTANT_NameAndType);
+        emitShort(nameIndex);
+        emitShort(typeIndex);
+        cpIdx++;
+    }
+
+    public void emitConstantPoolFieldref
+        (short classIndex, short nameAndTypeIndex)
+    {
+        emitByte(CONSTANT_Fieldref);
+        emitShort(classIndex);
+        emitShort(nameAndTypeIndex);
+        cpIdx++;
+    }
+
+    public void emitConstantPoolMethodref
+        (short classIndex, short nameAndTypeIndex)
+    {
+        emitByte(CONSTANT_Methodref);
+        emitShort(classIndex);
+        emitShort(nameAndTypeIndex);
+        cpIdx++;
+    }
+
+    public void emitConstantPoolInterfaceMethodref
+        (short classIndex, short nameAndTypeIndex)
+    {
+        emitByte(CONSTANT_InterfaceMethodref);
+        emitShort(classIndex);
+        emitShort(nameAndTypeIndex);
+        cpIdx++;
+    }
+
+    public void emitConstantPoolString(short utf8Index) {
+        emitByte(CONSTANT_String);
+        emitShort(utf8Index);
+        cpIdx++;
+    }
+
+    //----------------------------------------------------------------------
+    // Opcodes. Keeps track of maximum stack and locals. Make a new
+    // assembler for each piece of assembled code, then append the
+    // result to the previous assembler's class file.
+    //
+
+    private int stack     = 0;
+    private int maxStack  = 0;
+    private int maxLocals = 0;
+
+    private void incStack() {
+        setStack(stack + 1);
+    }
+
+    private void decStack() {
+        --stack;
+    }
+
+    public short getMaxStack() {
+        return (short) maxStack;
+    }
+
+    public short getMaxLocals() {
+        return (short) maxLocals;
+    }
+
+    /** It's necessary to be able to specify the number of arguments at
+        the beginning of the method (which translates to the initial
+        value of max locals) */
+    public void setMaxLocals(int maxLocals) {
+        this.maxLocals = maxLocals;
+    }
+
+    /** Needed to do flow control. Returns current stack depth. */
+    public int getStack() {
+        return stack;
+    }
+
+    /** Needed to do flow control. */
+    public void setStack(int value) {
+        stack = value;
+        if (stack > maxStack) {
+            maxStack = stack;
+        }
+    }
+
+    ///////////////
+    // Constants //
+    ///////////////
+
+    public void opc_aconst_null() {
+        emitByte(opc_aconst_null);
+        incStack();
+    }
+
+    public void opc_sipush(short constant) {
+        emitByte(opc_sipush);
+        emitShort(constant);
+        incStack();
+    }
+
+    public void opc_ldc(byte cpIdx) {
+        emitByte(opc_ldc);
+        emitByte(cpIdx);
+        incStack();
+    }
+
+    /////////////////////////////////////
+    // Local variable loads and stores //
+    /////////////////////////////////////
+
+    public void opc_iload_0() {
+        emitByte(opc_iload_0);
+        if (maxLocals < 1) maxLocals = 1;
+        incStack();
+    }
+
+    public void opc_iload_1() {
+        emitByte(opc_iload_1);
+        if (maxLocals < 2) maxLocals = 2;
+        incStack();
+    }
+
+    public void opc_iload_2() {
+        emitByte(opc_iload_2);
+        if (maxLocals < 3) maxLocals = 3;
+        incStack();
+    }
+
+    public void opc_iload_3() {
+        emitByte(opc_iload_3);
+        if (maxLocals < 4) maxLocals = 4;
+        incStack();
+    }
+
+    public void opc_lload_0() {
+        emitByte(opc_lload_0);
+        if (maxLocals < 2) maxLocals = 2;
+        incStack();
+        incStack();
+    }
+
+    public void opc_lload_1() {
+        emitByte(opc_lload_1);
+        if (maxLocals < 3) maxLocals = 3;
+        incStack();
+        incStack();
+    }
+
+    public void opc_lload_2() {
+        emitByte(opc_lload_2);
+        if (maxLocals < 4) maxLocals = 4;
+        incStack();
+        incStack();
+    }
+
+    public void opc_lload_3() {
+        emitByte(opc_lload_3);
+        if (maxLocals < 5) maxLocals = 5;
+        incStack();
+        incStack();
+    }
+
+    public void opc_fload_0() {
+        emitByte(opc_fload_0);
+        if (maxLocals < 1) maxLocals = 1;
+        incStack();
+    }
+
+    public void opc_fload_1() {
+        emitByte(opc_fload_1);
+        if (maxLocals < 2) maxLocals = 2;
+        incStack();
+    }
+
+    public void opc_fload_2() {
+        emitByte(opc_fload_2);
+        if (maxLocals < 3) maxLocals = 3;
+        incStack();
+    }
+
+    public void opc_fload_3() {
+        emitByte(opc_fload_3);
+        if (maxLocals < 4) maxLocals = 4;
+        incStack();
+    }
+
+    public void opc_dload_0() {
+        emitByte(opc_dload_0);
+        if (maxLocals < 2) maxLocals = 2;
+        incStack();
+        incStack();
+    }
+
+    public void opc_dload_1() {
+        emitByte(opc_dload_1);
+        if (maxLocals < 3) maxLocals = 3;
+        incStack();
+        incStack();
+    }
+
+    public void opc_dload_2() {
+        emitByte(opc_dload_2);
+        if (maxLocals < 4) maxLocals = 4;
+        incStack();
+        incStack();
+    }
+
+    public void opc_dload_3() {
+        emitByte(opc_dload_3);
+        if (maxLocals < 5) maxLocals = 5;
+        incStack();
+        incStack();
+    }
+
+    public void opc_aload_0() {
+        emitByte(opc_aload_0);
+        if (maxLocals < 1) maxLocals = 1;
+        incStack();
+    }
+
+    public void opc_aload_1() {
+        emitByte(opc_aload_1);
+        if (maxLocals < 2) maxLocals = 2;
+        incStack();
+    }
+
+    public void opc_aload_2() {
+        emitByte(opc_aload_2);
+        if (maxLocals < 3) maxLocals = 3;
+        incStack();
+    }
+
+    public void opc_aload_3() {
+        emitByte(opc_aload_3);
+        if (maxLocals < 4) maxLocals = 4;
+        incStack();
+    }
+
+    public void opc_aaload() {
+        emitByte(opc_aaload);
+        decStack();
+    }
+
+    public void opc_astore_0() {
+        emitByte(opc_astore_0);
+        if (maxLocals < 1) maxLocals = 1;
+        decStack();
+    }
+
+    public void opc_astore_1() {
+        emitByte(opc_astore_1);
+        if (maxLocals < 2) maxLocals = 2;
+        decStack();
+    }
+
+    public void opc_astore_2() {
+        emitByte(opc_astore_2);
+        if (maxLocals < 3) maxLocals = 3;
+        decStack();
+    }
+
+    public void opc_astore_3() {
+        emitByte(opc_astore_3);
+        if (maxLocals < 4) maxLocals = 4;
+        decStack();
+    }
+
+    ////////////////////////
+    // Stack manipulation //
+    ////////////////////////
+
+    public void opc_pop() {
+        emitByte(opc_pop);
+        decStack();
+    }
+
+    public void opc_dup() {
+        emitByte(opc_dup);
+        incStack();
+    }
+
+    public void opc_dup_x1() {
+        emitByte(opc_dup_x1);
+        incStack();
+    }
+
+    public void opc_swap() {
+        emitByte(opc_swap);
+    }
+
+    ///////////////////////////////
+    // Widening conversions only //
+    ///////////////////////////////
+
+    public void opc_i2l() {
+        emitByte(opc_i2l);
+    }
+
+    public void opc_i2f() {
+        emitByte(opc_i2f);
+    }
+
+    public void opc_i2d() {
+        emitByte(opc_i2d);
+    }
+
+    public void opc_l2f() {
+        emitByte(opc_l2f);
+    }
+
+    public void opc_l2d() {
+        emitByte(opc_l2d);
+    }
+
+    public void opc_f2d() {
+        emitByte(opc_f2d);
+    }
+
+    //////////////////
+    // Control flow //
+    //////////////////
+
+    public void opc_ifeq(short bciOffset) {
+        emitByte(opc_ifeq);
+        emitShort(bciOffset);
+        decStack();
+    }
+
+    /** Control flow with forward-reference BCI. Stack assumes
+        straight-through control flow. */
+    public void opc_ifeq(Label l) {
+        short instrBCI = getLength();
+        emitByte(opc_ifeq);
+        l.add(this, instrBCI, getLength(), getStack() - 1);
+        emitShort((short) -1); // Must be patched later
+    }
+
+    public void opc_if_icmpeq(short bciOffset) {
+        emitByte(opc_if_icmpeq);
+        emitShort(bciOffset);
+        setStack(getStack() - 2);
+    }
+
+    /** Control flow with forward-reference BCI. Stack assumes straight
+        control flow. */
+    public void opc_if_icmpeq(Label l) {
+        short instrBCI = getLength();
+        emitByte(opc_if_icmpeq);
+        l.add(this, instrBCI, getLength(), getStack() - 2);
+        emitShort((short) -1); // Must be patched later
+    }
+
+    public void opc_goto(short bciOffset) {
+        emitByte(opc_goto);
+        emitShort(bciOffset);
+    }
+
+    /** Control flow with forward-reference BCI. Stack assumes straight
+        control flow. */
+    public void opc_goto(Label l) {
+        short instrBCI = getLength();
+        emitByte(opc_goto);
+        l.add(this, instrBCI, getLength(), getStack());
+        emitShort((short) -1); // Must be patched later
+    }
+
+    public void opc_ifnull(short bciOffset) {
+        emitByte(opc_ifnull);
+        emitShort(bciOffset);
+        decStack();
+    }
+
+    /** Control flow with forward-reference BCI. Stack assumes straight
+        control flow. */
+    public void opc_ifnull(Label l) {
+        short instrBCI = getLength();
+        emitByte(opc_ifnull);
+        l.add(this, instrBCI, getLength(), getStack() - 1);
+        emitShort((short) -1); // Must be patched later
+        decStack();
+    }
+
+    public void opc_ifnonnull(short bciOffset) {
+        emitByte(opc_ifnonnull);
+        emitShort(bciOffset);
+        decStack();
+    }
+
+    /** Control flow with forward-reference BCI. Stack assumes straight
+        control flow. */
+    public void opc_ifnonnull(Label l) {
+        short instrBCI = getLength();
+        emitByte(opc_ifnonnull);
+        l.add(this, instrBCI, getLength(), getStack() - 1);
+        emitShort((short) -1); // Must be patched later
+        decStack();
+    }
+
+    /////////////////////////
+    // Return instructions //
+    /////////////////////////
+
+    public void opc_ireturn() {
+        emitByte(opc_ireturn);
+        setStack(0);
+    }
+
+    public void opc_lreturn() {
+        emitByte(opc_lreturn);
+        setStack(0);
+    }
+
+    public void opc_freturn() {
+        emitByte(opc_freturn);
+        setStack(0);
+    }
+
+    public void opc_dreturn() {
+        emitByte(opc_dreturn);
+        setStack(0);
+    }
+
+    public void opc_areturn() {
+        emitByte(opc_areturn);
+        setStack(0);
+    }
+
+    public void opc_return() {
+        emitByte(opc_return);
+        setStack(0);
+    }
+
+    //////////////////////
+    // Field operations //
+    //////////////////////
+
+    public void opc_getstatic(short fieldIndex, int fieldSizeInStackSlots) {
+        emitByte(opc_getstatic);
+        emitShort(fieldIndex);
+        setStack(getStack() + fieldSizeInStackSlots);
+    }
+
+    public void opc_putstatic(short fieldIndex, int fieldSizeInStackSlots) {
+        emitByte(opc_putstatic);
+        emitShort(fieldIndex);
+        setStack(getStack() - fieldSizeInStackSlots);
+    }
+
+    public void opc_getfield(short fieldIndex, int fieldSizeInStackSlots) {
+        emitByte(opc_getfield);
+        emitShort(fieldIndex);
+        setStack(getStack() + fieldSizeInStackSlots - 1);
+    }
+
+    public void opc_putfield(short fieldIndex, int fieldSizeInStackSlots) {
+        emitByte(opc_putfield);
+        emitShort(fieldIndex);
+        setStack(getStack() - fieldSizeInStackSlots - 1);
+    }
+
+    ////////////////////////
+    // Method invocations //
+    ////////////////////////
+
+    /** Long and double arguments and return types count as 2 arguments;
+        other values count as 1. */
+    public void opc_invokevirtual(short methodIndex,
+                                  int numArgs,
+                                  int numReturnValues)
+    {
+        emitByte(opc_invokevirtual);
+        emitShort(methodIndex);
+        setStack(getStack() - numArgs - 1 + numReturnValues);
+    }
+
+    /** Long and double arguments and return types count as 2 arguments;
+        other values count as 1. */
+    public void opc_invokespecial(short methodIndex,
+                                  int numArgs,
+                                  int numReturnValues)
+    {
+        emitByte(opc_invokespecial);
+        emitShort(methodIndex);
+        setStack(getStack() - numArgs - 1 + numReturnValues);
+    }
+
+    /** Long and double arguments and return types count as 2 arguments;
+        other values count as 1. */
+    public void opc_invokestatic(short methodIndex,
+                                 int numArgs,
+                                 int numReturnValues)
+    {
+        emitByte(opc_invokestatic);
+        emitShort(methodIndex);
+        setStack(getStack() - numArgs + numReturnValues);
+    }
+
+    /** Long and double arguments and return types count as 2 arguments;
+        other values count as 1. */
+    public void opc_invokeinterface(short methodIndex,
+                                    int numArgs,
+                                    byte count,
+                                    int numReturnValues)
+    {
+        emitByte(opc_invokeinterface);
+        emitShort(methodIndex);
+        emitByte(count);
+        emitByte((byte) 0);
+        setStack(getStack() - numArgs - 1 + numReturnValues);
+    }
+
+    //////////////////
+    // Array length //
+    //////////////////
+
+    public void opc_arraylength() {
+        emitByte(opc_arraylength);
+    }
+
+    /////////
+    // New //
+    /////////
+
+    public void opc_new(short classIndex) {
+        emitByte(opc_new);
+        emitShort(classIndex);
+        incStack();
+    }
+
+    ////////////
+    // Athrow //
+    ////////////
+
+    public void opc_athrow() {
+        emitByte(opc_athrow);
+        setStack(1);
+    }
+
+    //////////////////////////////
+    // Checkcast and instanceof //
+    //////////////////////////////
+
+    /** Assumes the checkcast succeeds */
+    public void opc_checkcast(short classIndex) {
+        emitByte(opc_checkcast);
+        emitShort(classIndex);
+    }
+
+    public void opc_instanceof(short classIndex) {
+        emitByte(opc_instanceof);
+        emitShort(classIndex);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ClassFileConstants.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,140 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** Minimal set of class file constants for assembly of field and
+    method accessors. */
+
+interface ClassFileConstants {
+    // Constants
+    public static final byte opc_aconst_null   = (byte) 0x1;
+    public static final byte opc_sipush        = (byte) 0x11;
+    public static final byte opc_ldc           = (byte) 0x12;
+
+    // Local variable loads and stores
+    public static final byte opc_iload_0       = (byte) 0x1a;
+    public static final byte opc_iload_1       = (byte) 0x1b;
+    public static final byte opc_iload_2       = (byte) 0x1c;
+    public static final byte opc_iload_3       = (byte) 0x1d;
+    public static final byte opc_lload_0       = (byte) 0x1e;
+    public static final byte opc_lload_1       = (byte) 0x1f;
+    public static final byte opc_lload_2       = (byte) 0x20;
+    public static final byte opc_lload_3       = (byte) 0x21;
+    public static final byte opc_fload_0       = (byte) 0x22;
+    public static final byte opc_fload_1       = (byte) 0x23;
+    public static final byte opc_fload_2       = (byte) 0x24;
+    public static final byte opc_fload_3       = (byte) 0x25;
+    public static final byte opc_dload_0       = (byte) 0x26;
+    public static final byte opc_dload_1       = (byte) 0x27;
+    public static final byte opc_dload_2       = (byte) 0x28;
+    public static final byte opc_dload_3       = (byte) 0x29;
+    public static final byte opc_aload_0       = (byte) 0x2a;
+    public static final byte opc_aload_1       = (byte) 0x2b;
+    public static final byte opc_aload_2       = (byte) 0x2c;
+    public static final byte opc_aload_3       = (byte) 0x2d;
+    public static final byte opc_aaload        = (byte) 0x32;
+    public static final byte opc_astore_0      = (byte) 0x4b;
+    public static final byte opc_astore_1      = (byte) 0x4c;
+    public static final byte opc_astore_2      = (byte) 0x4d;
+    public static final byte opc_astore_3      = (byte) 0x4e;
+
+    // Stack manipulation
+    public static final byte opc_pop           = (byte) 0x57;
+    public static final byte opc_dup           = (byte) 0x59;
+    public static final byte opc_dup_x1        = (byte) 0x5a;
+    public static final byte opc_swap          = (byte) 0x5f;
+
+    // Conversions
+    public static final byte opc_i2l           = (byte) 0x85;
+    public static final byte opc_i2f           = (byte) 0x86;
+    public static final byte opc_i2d           = (byte) 0x87;
+    public static final byte opc_l2i           = (byte) 0x88;
+    public static final byte opc_l2f           = (byte) 0x89;
+    public static final byte opc_l2d           = (byte) 0x8a;
+    public static final byte opc_f2i           = (byte) 0x8b;
+    public static final byte opc_f2l           = (byte) 0x8c;
+    public static final byte opc_f2d           = (byte) 0x8d;
+    public static final byte opc_d2i           = (byte) 0x8e;
+    public static final byte opc_d2l           = (byte) 0x8f;
+    public static final byte opc_d2f           = (byte) 0x90;
+    public static final byte opc_i2b           = (byte) 0x91;
+    public static final byte opc_i2c           = (byte) 0x92;
+    public static final byte opc_i2s           = (byte) 0x93;
+
+    // Control flow
+    public static final byte opc_ifeq          = (byte) 0x99;
+    public static final byte opc_if_icmpeq     = (byte) 0x9f;
+    public static final byte opc_goto          = (byte) 0xa7;
+
+    // Return instructions
+    public static final byte opc_ireturn       = (byte) 0xac;
+    public static final byte opc_lreturn       = (byte) 0xad;
+    public static final byte opc_freturn       = (byte) 0xae;
+    public static final byte opc_dreturn       = (byte) 0xaf;
+    public static final byte opc_areturn       = (byte) 0xb0;
+    public static final byte opc_return        = (byte) 0xb1;
+
+    // Field operations
+    public static final byte opc_getstatic     = (byte) 0xb2;
+    public static final byte opc_putstatic     = (byte) 0xb3;
+    public static final byte opc_getfield      = (byte) 0xb4;
+    public static final byte opc_putfield      = (byte) 0xb5;
+
+    // Method invocations
+    public static final byte opc_invokevirtual   = (byte) 0xb6;
+    public static final byte opc_invokespecial   = (byte) 0xb7;
+    public static final byte opc_invokestatic    = (byte) 0xb8;
+    public static final byte opc_invokeinterface = (byte) 0xb9;
+
+    // Array length
+    public static final byte opc_arraylength     = (byte) 0xbe;
+
+    // New
+    public static final byte opc_new           = (byte) 0xbb;
+
+    // Athrow
+    public static final byte opc_athrow        = (byte) 0xbf;
+
+    // Checkcast and instanceof
+    public static final byte opc_checkcast     = (byte) 0xc0;
+    public static final byte opc_instanceof    = (byte) 0xc1;
+
+    // Ifnull and ifnonnull
+    public static final byte opc_ifnull        = (byte) 0xc6;
+    public static final byte opc_ifnonnull     = (byte) 0xc7;
+
+    // Constant pool tags
+    public static final byte CONSTANT_Class              = (byte) 7;
+    public static final byte CONSTANT_Fieldref           = (byte) 9;
+    public static final byte CONSTANT_Methodref          = (byte) 10;
+    public static final byte CONSTANT_InterfaceMethodref = (byte) 11;
+    public static final byte CONSTANT_NameAndType        = (byte) 12;
+    public static final byte CONSTANT_String             = (byte) 8;
+    public static final byte CONSTANT_Utf8               = (byte) 1;
+
+    // Access flags
+    public static final short ACC_PUBLIC = (short) 0x0001;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ConstantPool.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2003, 2015, 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 jdk.internal.reflect;
+
+import java.lang.reflect.*;
+
+/** Provides reflective access to the constant pools of classes.
+    Currently this is needed to provide reflective access to annotations
+    but may be used by other internal subsystems in the future. */
+
+public class ConstantPool {
+  // Number of entries in this constant pool (= maximum valid constant pool index)
+  public int      getSize()                      { return getSize0            (constantPoolOop);        }
+  public Class<?> getClassAt         (int index) { return getClassAt0         (constantPoolOop, index); }
+  public Class<?> getClassAtIfLoaded (int index) { return getClassAtIfLoaded0 (constantPoolOop, index); }
+  // Returns a class reference index for a method or a field.
+  public int getClassRefIndexAt(int index) {
+      return getClassRefIndexAt0(constantPoolOop, index);
+  }
+  // Returns either a Method or Constructor.
+  // Static initializers are returned as Method objects.
+  public Member   getMethodAt        (int index) { return getMethodAt0        (constantPoolOop, index); }
+  public Member   getMethodAtIfLoaded(int index) { return getMethodAtIfLoaded0(constantPoolOop, index); }
+  public Field    getFieldAt         (int index) { return getFieldAt0         (constantPoolOop, index); }
+  public Field    getFieldAtIfLoaded (int index) { return getFieldAtIfLoaded0 (constantPoolOop, index); }
+  // Fetches the class name, member (field, method or interface
+  // method) name, and type descriptor as an array of three Strings
+  public String[] getMemberRefInfoAt (int index) { return getMemberRefInfoAt0 (constantPoolOop, index); }
+  // Returns a name and type reference index for a method, a field or an invokedynamic.
+  public int getNameAndTypeRefIndexAt(int index) {
+      return getNameAndTypeRefIndexAt0(constantPoolOop, index);
+  }
+  // Fetches the name and type from name_and_type index as an array of two Strings
+  public String[] getNameAndTypeRefInfoAt(int index) {
+      return getNameAndTypeRefInfoAt0(constantPoolOop, index);
+  }
+  public int      getIntAt           (int index) { return getIntAt0           (constantPoolOop, index); }
+  public long     getLongAt          (int index) { return getLongAt0          (constantPoolOop, index); }
+  public float    getFloatAt         (int index) { return getFloatAt0         (constantPoolOop, index); }
+  public double   getDoubleAt        (int index) { return getDoubleAt0        (constantPoolOop, index); }
+  public String   getStringAt        (int index) { return getStringAt0        (constantPoolOop, index); }
+  public String   getUTF8At          (int index) { return getUTF8At0          (constantPoolOop, index); }
+  public Tag getTagAt(int index) {
+      return Tag.valueOf(getTagAt0(constantPoolOop, index));
+  }
+
+  public static enum Tag {
+      UTF8(1),
+      INTEGER(3),
+      FLOAT(4),
+      LONG(5),
+      DOUBLE(6),
+      CLASS(7),
+      STRING(8),
+      FIELDREF(9),
+      METHODREF(10),
+      INTERFACEMETHODREF(11),
+      NAMEANDTYPE(12),
+      METHODHANDLE(15),
+      METHODTYPE(16),
+      INVOKEDYNAMIC(18),
+      INVALID(0);
+
+      private final int tagCode;
+
+      private Tag(int tagCode) {
+          this.tagCode = tagCode;
+      }
+
+      private static Tag valueOf(byte v) {
+          for (Tag tag : Tag.values()) {
+              if (tag.tagCode == v) {
+                  return tag;
+              }
+          }
+          throw new IllegalArgumentException("Unknown constant pool tag code " + v);
+      }
+   }
+  //---------------------------------------------------------------------------
+  // Internals only below this point
+  //
+
+  static {
+      Reflection.registerFieldsToFilter(ConstantPool.class, new String[] { "constantPoolOop" });
+  }
+
+  // HotSpot-internal constant pool object (set by the VM, name known to the VM)
+  private Object constantPoolOop;
+
+  private native int      getSize0            (Object constantPoolOop);
+  private native Class<?> getClassAt0         (Object constantPoolOop, int index);
+  private native Class<?> getClassAtIfLoaded0 (Object constantPoolOop, int index);
+  private native int      getClassRefIndexAt0 (Object constantPoolOop, int index);
+  private native Member   getMethodAt0        (Object constantPoolOop, int index);
+  private native Member   getMethodAtIfLoaded0(Object constantPoolOop, int index);
+  private native Field    getFieldAt0         (Object constantPoolOop, int index);
+  private native Field    getFieldAtIfLoaded0 (Object constantPoolOop, int index);
+  private native String[] getMemberRefInfoAt0 (Object constantPoolOop, int index);
+  private native int      getNameAndTypeRefIndexAt0(Object constantPoolOop, int index);
+  private native String[] getNameAndTypeRefInfoAt0(Object constantPoolOop, int index);
+  private native int      getIntAt0           (Object constantPoolOop, int index);
+  private native long     getLongAt0          (Object constantPoolOop, int index);
+  private native float    getFloatAt0         (Object constantPoolOop, int index);
+  private native double   getDoubleAt0        (Object constantPoolOop, int index);
+  private native String   getStringAt0        (Object constantPoolOop, int index);
+  private native String   getUTF8At0          (Object constantPoolOop, int index);
+  private native byte     getTagAt0           (Object constantPoolOop, int index);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessor.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** This interface provides the declaration for
+    java.lang.reflect.Constructor.invoke(). Each Constructor object is
+    configured with a (possibly dynamically-generated) class which
+    implements this interface. */
+
+public interface ConstructorAccessor {
+    /** Matches specification in {@link java.lang.reflect.Constructor} */
+    public Object newInstance(Object[] args)
+        throws InstantiationException,
+               IllegalArgumentException,
+               InvocationTargetException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,41 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Package-private implementation of the ConstructorAccessor
+    interface which has access to all classes and all fields,
+    regardless of language restrictions. See MagicAccessorImpl. */
+
+abstract class ConstructorAccessorImpl extends MagicAccessorImpl
+    implements ConstructorAccessor {
+    /** Matches specification in {@link java.lang.reflect.Constructor} */
+    public abstract Object newInstance(Object[] args)
+        throws InstantiationException,
+               IllegalArgumentException,
+               InvocationTargetException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/DelegatingConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,51 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Delegates its invocation to another ConstructorAccessorImpl and can
+    change its delegate at run time. */
+
+class DelegatingConstructorAccessorImpl extends ConstructorAccessorImpl {
+    private ConstructorAccessorImpl delegate;
+
+    DelegatingConstructorAccessorImpl(ConstructorAccessorImpl delegate) {
+        setDelegate(delegate);
+    }
+
+    public Object newInstance(Object[] args)
+      throws InstantiationException,
+             IllegalArgumentException,
+             InvocationTargetException
+    {
+        return delegate.newInstance(args);
+    }
+
+    void setDelegate(ConstructorAccessorImpl delegate) {
+        this.delegate = delegate;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/DelegatingMethodAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,49 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Delegates its invocation to another MethodAccessorImpl and can
+    change its delegate at run time. */
+
+class DelegatingMethodAccessorImpl extends MethodAccessorImpl {
+    private MethodAccessorImpl delegate;
+
+    DelegatingMethodAccessorImpl(MethodAccessorImpl delegate) {
+        setDelegate(delegate);
+    }
+
+    public Object invoke(Object obj, Object[] args)
+        throws IllegalArgumentException, InvocationTargetException
+    {
+        return delegate.invoke(obj, args);
+    }
+
+    void setDelegate(MethodAccessorImpl delegate) {
+        this.delegate = delegate;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/FieldAccessor.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,96 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** This interface provides the declarations for the accessor methods
+    of java.lang.reflect.Field. Each Field object is configured with a
+    (possibly dynamically-generated) class which implements this
+    interface. */
+
+public interface FieldAccessor {
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public Object get(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public boolean getBoolean(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public byte getByte(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public char getChar(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public short getShort(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public int getInt(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public long getLong(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public float getFloat(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public double getDouble(Object obj) throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/FieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,105 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** Package-private implementation of the FieldAccessor interface
+    which has access to all classes and all fields, regardless of
+    language restrictions. See MagicAccessorImpl. */
+
+abstract class FieldAccessorImpl extends MagicAccessorImpl
+    implements FieldAccessor {
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract Object get(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract boolean getBoolean(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract byte getByte(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract char getChar(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract short getShort(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract int getInt(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract long getLong(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract float getFloat(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract double getDouble(Object obj)
+        throws IllegalArgumentException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException;
+
+    /** Matches specification in {@link java.lang.reflect.Field} */
+    public abstract void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/InstantiationExceptionConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,52 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+/** Throws an InstantiationException with given error message upon
+    newInstance() call */
+
+class InstantiationExceptionConstructorAccessorImpl
+    extends ConstructorAccessorImpl {
+    private final String message;
+
+    InstantiationExceptionConstructorAccessorImpl(String message) {
+        this.message = message;
+    }
+
+    public Object newInstance(Object[] args)
+        throws InstantiationException,
+               IllegalArgumentException,
+               InvocationTargetException
+    {
+        if (message == null) {
+            throw new InstantiationException();
+        }
+        throw new InstantiationException(message);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/Label.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2001, 2011, 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 jdk.internal.reflect;
+
+import java.util.List;
+import java.util.ArrayList;
+
+/** Allows forward references in bytecode streams emitted by
+    ClassFileAssembler. Assumes that the start of the method body is
+    the first byte in the assembler's buffer. May be used at more than
+    one branch site. */
+
+class Label {
+    static class PatchInfo {
+        PatchInfo(ClassFileAssembler asm,
+                  short instrBCI,
+                  short patchBCI,
+                  int stackDepth)
+        {
+            this.asm = asm;
+            this.instrBCI   = instrBCI;
+            this.patchBCI   = patchBCI;
+            this.stackDepth = stackDepth;
+        }
+        // This won't work for more than one assembler anyway, so this is
+        // unnecessary
+        final ClassFileAssembler asm;
+        final short instrBCI;
+        final short patchBCI;
+        final int   stackDepth;
+    }
+    private final List<PatchInfo> patches = new ArrayList<>();
+
+    public Label() {
+    }
+
+    void add(ClassFileAssembler asm,
+             short instrBCI,
+             short patchBCI,
+             int stackDepth)
+    {
+        patches.add(new PatchInfo(asm, instrBCI, patchBCI, stackDepth));
+    }
+
+    public void bind() {
+        for (PatchInfo patch : patches){
+            short curBCI = patch.asm.getLength();
+            short offset = (short) (curBCI - patch.instrBCI);
+            patch.asm.emitShort(patch.patchBCI, offset);
+            patch.asm.setStack(patch.stackDepth);
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/LangReflectAccess.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.lang.reflect.*;
+
+/** An interface which gives privileged packages Java-level access to
+    internals of java.lang.reflect. */
+
+public interface LangReflectAccess {
+    /** Creates a new java.lang.reflect.Field. Access checks as per
+        java.lang.reflect.AccessibleObject are not overridden. */
+    public Field newField(Class<?> declaringClass,
+                          String name,
+                          Class<?> type,
+                          int modifiers,
+                          int slot,
+                          String signature,
+                          byte[] annotations);
+
+    /** Creates a new java.lang.reflect.Method. Access checks as per
+      java.lang.reflect.AccessibleObject are not overridden. */
+    public Method newMethod(Class<?> declaringClass,
+                            String name,
+                            Class<?>[] parameterTypes,
+                            Class<?> returnType,
+                            Class<?>[] checkedExceptions,
+                            int modifiers,
+                            int slot,
+                            String signature,
+                            byte[] annotations,
+                            byte[] parameterAnnotations,
+                            byte[] annotationDefault);
+
+    /** Creates a new java.lang.reflect.Constructor. Access checks as
+      per java.lang.reflect.AccessibleObject are not overridden. */
+    public <T> Constructor<T> newConstructor(Class<T> declaringClass,
+                                             Class<?>[] parameterTypes,
+                                             Class<?>[] checkedExceptions,
+                                             int modifiers,
+                                             int slot,
+                                             String signature,
+                                             byte[] annotations,
+                                             byte[] parameterAnnotations);
+
+    /** Gets the MethodAccessor object for a java.lang.reflect.Method */
+    public MethodAccessor getMethodAccessor(Method m);
+
+    /** Sets the MethodAccessor object for a java.lang.reflect.Method */
+    public void setMethodAccessor(Method m, MethodAccessor accessor);
+
+    /** Gets the ConstructorAccessor object for a
+        java.lang.reflect.Constructor */
+    public ConstructorAccessor getConstructorAccessor(Constructor<?> c);
+
+    /** Sets the ConstructorAccessor object for a
+        java.lang.reflect.Constructor */
+    public void setConstructorAccessor(Constructor<?> c,
+                                       ConstructorAccessor accessor);
+
+    /** Gets the byte[] that encodes TypeAnnotations on an Executable. */
+    public byte[] getExecutableTypeAnnotationBytes(Executable ex);
+
+    /** Gets the "slot" field from a Constructor (used for serialization) */
+    public int getConstructorSlot(Constructor<?> c);
+
+    /** Gets the "signature" field from a Constructor (used for serialization) */
+    public String getConstructorSignature(Constructor<?> c);
+
+    /** Gets the "annotations" field from a Constructor (used for serialization) */
+    public byte[] getConstructorAnnotations(Constructor<?> c);
+
+    /** Gets the "parameterAnnotations" field from a Constructor (used for serialization) */
+    public byte[] getConstructorParameterAnnotations(Constructor<?> c);
+
+    //
+    // Copying routines, needed to quickly fabricate new Field,
+    // Method, and Constructor objects from templates
+    //
+
+    /** Makes a "child" copy of a Method */
+    public Method      copyMethod(Method arg);
+
+    /** Makes a copy of this non-root a Method */
+    public Method      leafCopyMethod(Method arg);
+
+    /** Makes a "child" copy of a Field */
+    public Field       copyField(Field arg);
+
+    /** Makes a "child" copy of a Constructor */
+    public <T> Constructor<T> copyConstructor(Constructor<T> arg);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/MagicAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,47 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** <P> MagicAccessorImpl (named for parity with FieldAccessorImpl and
+    others, not because it actually implements an interface) is a
+    marker class in the hierarchy. All subclasses of this class are
+    "magically" granted access by the VM to otherwise inaccessible
+    fields and methods of other classes. It is used to hold the code
+    for dynamically-generated FieldAccessorImpl and MethodAccessorImpl
+    subclasses. (Use of the word "unsafe" was avoided in this class's
+    name to avoid confusion with {@link jdk.internal.misc.Unsafe}.) </P>
+
+    <P> The bug fix for 4486457 also necessitated disabling
+    verification for this class and all subclasses, as opposed to just
+    SerializationConstructorAccessorImpl and subclasses, to avoid
+    having to indicate to the VM which of these dynamically-generated
+    stub classes were known to be able to pass the verifier. </P>
+
+    <P> Do not change the name of this class without also changing the
+    VM's code. </P> */
+
+class MagicAccessorImpl {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/MethodAccessor.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,40 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** This interface provides the declaration for
+    java.lang.reflect.Method.invoke(). Each Method object is
+    configured with a (possibly dynamically-generated) class which
+    implements this interface.
+*/
+
+public interface MethodAccessor {
+    /** Matches specification in {@link java.lang.reflect.Method} */
+    public Object invoke(Object obj, Object[] args)
+        throws IllegalArgumentException, InvocationTargetException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorGenerator.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/** Generator for sun.reflect.MethodAccessor and
+    sun.reflect.ConstructorAccessor objects using bytecodes to
+    implement reflection. A java.lang.reflect.Method or
+    java.lang.reflect.Constructor object can delegate its invoke or
+    newInstance method to an accessor using native code or to one
+    generated by this class. (Methods and Constructors were merged
+    together in this class to ensure maximum code sharing.) */
+
+class MethodAccessorGenerator extends AccessorGenerator {
+
+    private static final short NUM_BASE_CPOOL_ENTRIES   = (short) 12;
+    // One for invoke() plus one for constructor
+    private static final short NUM_METHODS              = (short) 2;
+    // Only used if forSerialization is true
+    private static final short NUM_SERIALIZATION_CPOOL_ENTRIES = (short) 2;
+
+    private static volatile int methodSymnum;
+    private static volatile int constructorSymnum;
+    private static volatile int serializationConstructorSymnum;
+
+    private Class<?>   declaringClass;
+    private Class<?>[] parameterTypes;
+    private Class<?>   returnType;
+    private boolean    isConstructor;
+    private boolean    forSerialization;
+
+    private short targetMethodRef;
+    private short invokeIdx;
+    private short invokeDescriptorIdx;
+    // Constant pool index of CONSTANT_Class_info for first
+    // non-primitive parameter type. Should be incremented by 2.
+    private short nonPrimitiveParametersBaseIdx;
+
+    MethodAccessorGenerator() {
+    }
+
+    /** This routine is not thread-safe */
+    public MethodAccessor generateMethod(Class<?> declaringClass,
+                                         String   name,
+                                         Class<?>[] parameterTypes,
+                                         Class<?>   returnType,
+                                         Class<?>[] checkedExceptions,
+                                         int modifiers)
+    {
+        return (MethodAccessor) generate(declaringClass,
+                                         name,
+                                         parameterTypes,
+                                         returnType,
+                                         checkedExceptions,
+                                         modifiers,
+                                         false,
+                                         false,
+                                         null);
+    }
+
+    /** This routine is not thread-safe */
+    public ConstructorAccessor generateConstructor(Class<?> declaringClass,
+                                                   Class<?>[] parameterTypes,
+                                                   Class<?>[] checkedExceptions,
+                                                   int modifiers)
+    {
+        return (ConstructorAccessor) generate(declaringClass,
+                                              "<init>",
+                                              parameterTypes,
+                                              Void.TYPE,
+                                              checkedExceptions,
+                                              modifiers,
+                                              true,
+                                              false,
+                                              null);
+    }
+
+    /** This routine is not thread-safe */
+    public SerializationConstructorAccessorImpl
+    generateSerializationConstructor(Class<?> declaringClass,
+                                     Class<?>[] parameterTypes,
+                                     Class<?>[] checkedExceptions,
+                                     int modifiers,
+                                     Class<?> targetConstructorClass)
+    {
+        return (SerializationConstructorAccessorImpl)
+            generate(declaringClass,
+                     "<init>",
+                     parameterTypes,
+                     Void.TYPE,
+                     checkedExceptions,
+                     modifiers,
+                     true,
+                     true,
+                     targetConstructorClass);
+    }
+
+    /** This routine is not thread-safe */
+    private MagicAccessorImpl generate(final Class<?> declaringClass,
+                                       String name,
+                                       Class<?>[] parameterTypes,
+                                       Class<?>   returnType,
+                                       Class<?>[] checkedExceptions,
+                                       int modifiers,
+                                       boolean isConstructor,
+                                       boolean forSerialization,
+                                       Class<?> serializationTargetClass)
+    {
+        ByteVector vec = ByteVectorFactory.create();
+        asm = new ClassFileAssembler(vec);
+        this.declaringClass = declaringClass;
+        this.parameterTypes = parameterTypes;
+        this.returnType = returnType;
+        this.modifiers = modifiers;
+        this.isConstructor = isConstructor;
+        this.forSerialization = forSerialization;
+
+        asm.emitMagicAndVersion();
+
+        // Constant pool entries:
+        // ( * = Boxing information: optional)
+        // (+  = Shared entries provided by AccessorGenerator)
+        // (^  = Only present if generating SerializationConstructorAccessor)
+        //     [UTF-8] [This class's name]
+        //     [CONSTANT_Class_info] for above
+        //     [UTF-8] "jdk/internal/reflect/{MethodAccessorImpl,ConstructorAccessorImpl,SerializationConstructorAccessorImpl}"
+        //     [CONSTANT_Class_info] for above
+        //     [UTF-8] [Target class's name]
+        //     [CONSTANT_Class_info] for above
+        // ^   [UTF-8] [Serialization: Class's name in which to invoke constructor]
+        // ^   [CONSTANT_Class_info] for above
+        //     [UTF-8] target method or constructor name
+        //     [UTF-8] target method or constructor signature
+        //     [CONSTANT_NameAndType_info] for above
+        //     [CONSTANT_Methodref_info or CONSTANT_InterfaceMethodref_info] for target method
+        //     [UTF-8] "invoke" or "newInstance"
+        //     [UTF-8] invoke or newInstance descriptor
+        //     [UTF-8] descriptor for type of non-primitive parameter 1
+        //     [CONSTANT_Class_info] for type of non-primitive parameter 1
+        //     ...
+        //     [UTF-8] descriptor for type of non-primitive parameter n
+        //     [CONSTANT_Class_info] for type of non-primitive parameter n
+        // +   [UTF-8] "java/lang/Exception"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/ClassCastException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/NullPointerException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/IllegalArgumentException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "java/lang/InvocationTargetException"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "<init>"
+        // +   [UTF-8] "()V"
+        // +   [CONSTANT_NameAndType_info] for above
+        // +   [CONSTANT_Methodref_info] for NullPointerException's constructor
+        // +   [CONSTANT_Methodref_info] for IllegalArgumentException's constructor
+        // +   [UTF-8] "(Ljava/lang/String;)V"
+        // +   [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/String;)V"
+        // +   [CONSTANT_Methodref_info] for IllegalArgumentException's constructor taking a String
+        // +   [UTF-8] "(Ljava/lang/Throwable;)V"
+        // +   [CONSTANT_NameAndType_info] for "<init>(Ljava/lang/Throwable;)V"
+        // +   [CONSTANT_Methodref_info] for InvocationTargetException's constructor
+        // +   [CONSTANT_Methodref_info] for "super()"
+        // +   [UTF-8] "java/lang/Object"
+        // +   [CONSTANT_Class_info] for above
+        // +   [UTF-8] "toString"
+        // +   [UTF-8] "()Ljava/lang/String;"
+        // +   [CONSTANT_NameAndType_info] for "toString()Ljava/lang/String;"
+        // +   [CONSTANT_Methodref_info] for Object's toString method
+        // +   [UTF-8] "Code"
+        // +   [UTF-8] "Exceptions"
+        //  *  [UTF-8] "java/lang/Boolean"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(Z)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "booleanValue"
+        //  *  [UTF-8] "()Z"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Byte"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(B)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "byteValue"
+        //  *  [UTF-8] "()B"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Character"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(C)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "charValue"
+        //  *  [UTF-8] "()C"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Double"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(D)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "doubleValue"
+        //  *  [UTF-8] "()D"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Float"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(F)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "floatValue"
+        //  *  [UTF-8] "()F"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Integer"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(I)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "intValue"
+        //  *  [UTF-8] "()I"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Long"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(J)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "longValue"
+        //  *  [UTF-8] "()J"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "java/lang/Short"
+        //  *  [CONSTANT_Class_info] for above
+        //  *  [UTF-8] "(S)V"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+        //  *  [UTF-8] "shortValue"
+        //  *  [UTF-8] "()S"
+        //  *  [CONSTANT_NameAndType_info] for above
+        //  *  [CONSTANT_Methodref_info] for above
+
+        short numCPEntries = NUM_BASE_CPOOL_ENTRIES + NUM_COMMON_CPOOL_ENTRIES;
+        boolean usesPrimitives = usesPrimitiveTypes();
+        if (usesPrimitives) {
+            numCPEntries += NUM_BOXING_CPOOL_ENTRIES;
+        }
+        if (forSerialization) {
+            numCPEntries += NUM_SERIALIZATION_CPOOL_ENTRIES;
+        }
+
+        // Add in variable-length number of entries to be able to describe
+        // non-primitive parameter types and checked exceptions.
+        numCPEntries += (short) (2 * numNonPrimitiveParameterTypes());
+
+        asm.emitShort(add(numCPEntries, S1));
+
+        final String generatedName = generateName(isConstructor, forSerialization);
+        asm.emitConstantPoolUTF8(generatedName);
+        asm.emitConstantPoolClass(asm.cpi());
+        thisClass = asm.cpi();
+        if (isConstructor) {
+            if (forSerialization) {
+                asm.emitConstantPoolUTF8
+                    ("jdk/internal/reflect/SerializationConstructorAccessorImpl");
+            } else {
+                asm.emitConstantPoolUTF8("jdk/internal/reflect/ConstructorAccessorImpl");
+            }
+        } else {
+            asm.emitConstantPoolUTF8("jdk/internal/reflect/MethodAccessorImpl");
+        }
+        asm.emitConstantPoolClass(asm.cpi());
+        superClass = asm.cpi();
+        asm.emitConstantPoolUTF8(getClassName(declaringClass, false));
+        asm.emitConstantPoolClass(asm.cpi());
+        targetClass = asm.cpi();
+        short serializationTargetClassIdx = (short) 0;
+        if (forSerialization) {
+            asm.emitConstantPoolUTF8(getClassName(serializationTargetClass, false));
+            asm.emitConstantPoolClass(asm.cpi());
+            serializationTargetClassIdx = asm.cpi();
+        }
+        asm.emitConstantPoolUTF8(name);
+        asm.emitConstantPoolUTF8(buildInternalSignature());
+        asm.emitConstantPoolNameAndType(sub(asm.cpi(), S1), asm.cpi());
+        if (isInterface()) {
+            asm.emitConstantPoolInterfaceMethodref(targetClass, asm.cpi());
+        } else {
+            if (forSerialization) {
+                asm.emitConstantPoolMethodref(serializationTargetClassIdx, asm.cpi());
+            } else {
+                asm.emitConstantPoolMethodref(targetClass, asm.cpi());
+            }
+        }
+        targetMethodRef = asm.cpi();
+        if (isConstructor) {
+            asm.emitConstantPoolUTF8("newInstance");
+        } else {
+            asm.emitConstantPoolUTF8("invoke");
+        }
+        invokeIdx = asm.cpi();
+        if (isConstructor) {
+            asm.emitConstantPoolUTF8("([Ljava/lang/Object;)Ljava/lang/Object;");
+        } else {
+            asm.emitConstantPoolUTF8
+                ("(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
+        }
+        invokeDescriptorIdx = asm.cpi();
+
+        // Output class information for non-primitive parameter types
+        nonPrimitiveParametersBaseIdx = add(asm.cpi(), S2);
+        for (int i = 0; i < parameterTypes.length; i++) {
+            Class<?> c = parameterTypes[i];
+            if (!isPrimitive(c)) {
+                asm.emitConstantPoolUTF8(getClassName(c, false));
+                asm.emitConstantPoolClass(asm.cpi());
+            }
+        }
+
+        // Entries common to FieldAccessor, MethodAccessor and ConstructorAccessor
+        emitCommonConstantPoolEntries();
+
+        // Boxing entries
+        if (usesPrimitives) {
+            emitBoxingContantPoolEntries();
+        }
+
+        if (asm.cpi() != numCPEntries) {
+            throw new InternalError("Adjust this code (cpi = " + asm.cpi() +
+                                    ", numCPEntries = " + numCPEntries + ")");
+        }
+
+        // Access flags
+        asm.emitShort(ACC_PUBLIC);
+
+        // This class
+        asm.emitShort(thisClass);
+
+        // Superclass
+        asm.emitShort(superClass);
+
+        // Interfaces count and interfaces
+        asm.emitShort(S0);
+
+        // Fields count and fields
+        asm.emitShort(S0);
+
+        // Methods count and methods
+        asm.emitShort(NUM_METHODS);
+
+        emitConstructor();
+        emitInvoke();
+
+        // Additional attributes (none)
+        asm.emitShort(S0);
+
+        // Load class
+        vec.trim();
+        final byte[] bytes = vec.getData();
+        // Note: the class loader is the only thing that really matters
+        // here -- it's important to get the generated code into the
+        // same namespace as the target class. Since the generated code
+        // is privileged anyway, the protection domain probably doesn't
+        // matter.
+        return AccessController.doPrivileged(
+            new PrivilegedAction<MagicAccessorImpl>() {
+                public MagicAccessorImpl run() {
+                        try {
+                        return (MagicAccessorImpl)
+                        ClassDefiner.defineClass
+                                (generatedName,
+                                 bytes,
+                                 0,
+                                 bytes.length,
+                                 declaringClass.getClassLoader()).newInstance();
+                        } catch (InstantiationException | IllegalAccessException e) {
+                            throw new InternalError(e);
+                        }
+                    }
+                });
+    }
+
+    /** This emits the code for either invoke() or newInstance() */
+    private void emitInvoke() {
+        // NOTE that this code will only handle 65535 parameters since we
+        // use the sipush instruction to get the array index on the
+        // operand stack.
+        if (parameterTypes.length > 65535) {
+            throw new InternalError("Can't handle more than 65535 parameters");
+        }
+
+        // Generate code into fresh code buffer
+        ClassFileAssembler cb = new ClassFileAssembler();
+        if (isConstructor) {
+            // 1 incoming argument
+            cb.setMaxLocals(2);
+        } else {
+            // 2 incoming arguments
+            cb.setMaxLocals(3);
+        }
+
+        short illegalArgStartPC = 0;
+
+        if (isConstructor) {
+            // Instantiate target class before continuing
+            // new <target class type>
+            // dup
+            cb.opc_new(targetClass);
+            cb.opc_dup();
+        } else {
+            // Setup before iterating down argument list
+            if (isPrimitive(returnType)) {
+                // new <boxing type for primitive type>
+                // dup
+                // ... (see below:)
+                // invokespecial <constructor for boxing type for primitive type>
+                // areturn
+                cb.opc_new(indexForPrimitiveType(returnType));
+                cb.opc_dup();
+            }
+
+            // Get target object on operand stack if necessary.
+
+            // We need to do an explicit null check here; we won't see
+            // NullPointerExceptions from the invoke bytecode, since it's
+            // covered by an exception handler.
+            if (!isStatic()) {
+                // aload_1
+                // ifnonnull <checkcast label>
+                // new <NullPointerException>
+                // dup
+                // invokespecial <NullPointerException ctor>
+                // athrow
+                // <checkcast label:>
+                // aload_1
+                // checkcast <target class's type>
+                cb.opc_aload_1();
+                Label l = new Label();
+                cb.opc_ifnonnull(l);
+                cb.opc_new(nullPointerClass);
+                cb.opc_dup();
+                cb.opc_invokespecial(nullPointerCtorIdx, 0, 0);
+                cb.opc_athrow();
+                l.bind();
+                illegalArgStartPC = cb.getLength();
+                cb.opc_aload_1();
+                cb.opc_checkcast(targetClass);
+            }
+        }
+
+        // Have to check length of incoming array and throw
+        // IllegalArgumentException if not correct. A concession to the
+        // JCK (isn't clearly specified in the spec): we allow null in the
+        // case where the argument list is zero length.
+        // if no-arg:
+        //   aload_2 | aload_1 (Method | Constructor)
+        //   ifnull <success label>
+        // aload_2 | aload_1
+        // arraylength
+        // sipush <num parameter types>
+        // if_icmpeq <success label>
+        // new <IllegalArgumentException>
+        // dup
+        // invokespecial <IllegalArgumentException ctor>
+        // athrow
+        // <success label:>
+        Label successLabel = new Label();
+        if (parameterTypes.length == 0) {
+            if (isConstructor) {
+                cb.opc_aload_1();
+            } else {
+                cb.opc_aload_2();
+            }
+            cb.opc_ifnull(successLabel);
+        }
+        if (isConstructor) {
+            cb.opc_aload_1();
+        } else {
+            cb.opc_aload_2();
+        }
+        cb.opc_arraylength();
+        cb.opc_sipush((short) parameterTypes.length);
+        cb.opc_if_icmpeq(successLabel);
+        cb.opc_new(illegalArgumentClass);
+        cb.opc_dup();
+        cb.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+        cb.opc_athrow();
+        successLabel.bind();
+
+        // Iterate through incoming actual parameters, ensuring that each
+        // is compatible with the formal parameter type, and pushing the
+        // actual on the operand stack (unboxing and widening if necessary).
+
+        short paramTypeCPIdx = nonPrimitiveParametersBaseIdx;
+        Label nextParamLabel = null;
+        byte count = 1; // both invokeinterface opcode's "count" as well as
+        // num args of other invoke bytecodes
+        for (int i = 0; i < parameterTypes.length; i++) {
+            Class<?> paramType = parameterTypes[i];
+            count += (byte) typeSizeInStackSlots(paramType);
+            if (nextParamLabel != null) {
+                nextParamLabel.bind();
+                nextParamLabel = null;
+            }
+            // aload_2 | aload_1
+            // sipush <index>
+            // aaload
+            if (isConstructor) {
+                cb.opc_aload_1();
+            } else {
+                cb.opc_aload_2();
+            }
+            cb.opc_sipush((short) i);
+            cb.opc_aaload();
+            if (isPrimitive(paramType)) {
+                // Unboxing code.
+                // Put parameter into temporary local variable
+                // astore_3 | astore_2
+                if (isConstructor) {
+                    cb.opc_astore_2();
+                } else {
+                    cb.opc_astore_3();
+                }
+
+                // repeat for all possible widening conversions:
+                //   aload_3 | aload_2
+                //   instanceof <primitive boxing type>
+                //   ifeq <next unboxing label>
+                //   aload_3 | aload_2
+                //   checkcast <primitive boxing type> // Note: this is "redundant",
+                //                                     // but necessary for the verifier
+                //   invokevirtual <unboxing method>
+                //   <widening conversion bytecode, if necessary>
+                //   goto <next parameter label>
+                // <next unboxing label:> ...
+                // last unboxing label:
+                //   new <IllegalArgumentException>
+                //   dup
+                //   invokespecial <IllegalArgumentException ctor>
+                //   athrow
+
+                Label l = null; // unboxing label
+                nextParamLabel = new Label();
+
+                for (int j = 0; j < primitiveTypes.length; j++) {
+                    Class<?> c = primitiveTypes[j];
+                    if (canWidenTo(c, paramType)) {
+                        if (l != null) {
+                            l.bind();
+                        }
+                        // Emit checking and unboxing code for this type
+                        if (isConstructor) {
+                            cb.opc_aload_2();
+                        } else {
+                            cb.opc_aload_3();
+                        }
+                        cb.opc_instanceof(indexForPrimitiveType(c));
+                        l = new Label();
+                        cb.opc_ifeq(l);
+                        if (isConstructor) {
+                            cb.opc_aload_2();
+                        } else {
+                            cb.opc_aload_3();
+                        }
+                        cb.opc_checkcast(indexForPrimitiveType(c));
+                        cb.opc_invokevirtual(unboxingMethodForPrimitiveType(c),
+                                             0,
+                                             typeSizeInStackSlots(c));
+                        emitWideningBytecodeForPrimitiveConversion(cb,
+                                                                   c,
+                                                                   paramType);
+                        cb.opc_goto(nextParamLabel);
+                    }
+                }
+
+                if (l == null) {
+                    throw new InternalError
+                        ("Must have found at least identity conversion");
+                }
+
+                // Fell through; given object is null or invalid. According to
+                // the spec, we can throw IllegalArgumentException for both of
+                // these cases.
+
+                l.bind();
+                cb.opc_new(illegalArgumentClass);
+                cb.opc_dup();
+                cb.opc_invokespecial(illegalArgumentCtorIdx, 0, 0);
+                cb.opc_athrow();
+            } else {
+                // Emit appropriate checkcast
+                cb.opc_checkcast(paramTypeCPIdx);
+                paramTypeCPIdx = add(paramTypeCPIdx, S2);
+                // Fall through to next argument
+            }
+        }
+        // Bind last goto if present
+        if (nextParamLabel != null) {
+            nextParamLabel.bind();
+        }
+
+        short invokeStartPC = cb.getLength();
+
+        // OK, ready to perform the invocation.
+        if (isConstructor) {
+            cb.opc_invokespecial(targetMethodRef, count, 0);
+        } else {
+            if (isStatic()) {
+                cb.opc_invokestatic(targetMethodRef,
+                                    count,
+                                    typeSizeInStackSlots(returnType));
+            } else {
+                if (isInterface()) {
+                    if (isPrivate()) {
+                        cb.opc_invokespecial(targetMethodRef, count, 0);
+                    } else {
+                        cb.opc_invokeinterface(targetMethodRef,
+                                               count,
+                                               count,
+                                               typeSizeInStackSlots(returnType));
+                    }
+                } else {
+                    cb.opc_invokevirtual(targetMethodRef,
+                                         count,
+                                         typeSizeInStackSlots(returnType));
+                }
+            }
+        }
+
+        short invokeEndPC = cb.getLength();
+
+        if (!isConstructor) {
+            // Box return value if necessary
+            if (isPrimitive(returnType)) {
+                cb.opc_invokestatic(boxingMethodForPrimitiveType(returnType),
+                                    typeSizeInStackSlots(returnType),
+                                    0);
+            } else if (returnType == Void.TYPE) {
+                cb.opc_aconst_null();
+            }
+        }
+        cb.opc_areturn();
+
+        // We generate two exception handlers; one which is responsible
+        // for catching ClassCastException and NullPointerException and
+        // throwing IllegalArgumentException, and the other which catches
+        // all java/lang/Throwable objects thrown from the target method
+        // and wraps them in InvocationTargetExceptions.
+
+        short classCastHandler = cb.getLength();
+
+        // ClassCast, etc. exception handler
+        cb.setStack(1);
+        cb.opc_invokespecial(toStringIdx, 0, 1);
+        cb.opc_new(illegalArgumentClass);
+        cb.opc_dup_x1();
+        cb.opc_swap();
+        cb.opc_invokespecial(illegalArgumentStringCtorIdx, 1, 0);
+        cb.opc_athrow();
+
+        short invocationTargetHandler = cb.getLength();
+
+        // InvocationTargetException exception handler
+        cb.setStack(1);
+        cb.opc_new(invocationTargetClass);
+        cb.opc_dup_x1();
+        cb.opc_swap();
+        cb.opc_invokespecial(invocationTargetCtorIdx, 1, 0);
+        cb.opc_athrow();
+
+        // Generate exception table. We cover the entire code sequence
+        // with an exception handler which catches ClassCastException and
+        // converts it into an IllegalArgumentException.
+
+        ClassFileAssembler exc = new ClassFileAssembler();
+
+        exc.emitShort(illegalArgStartPC);       // start PC
+        exc.emitShort(invokeStartPC);           // end PC
+        exc.emitShort(classCastHandler);        // handler PC
+        exc.emitShort(classCastClass);          // catch type
+
+        exc.emitShort(illegalArgStartPC);       // start PC
+        exc.emitShort(invokeStartPC);           // end PC
+        exc.emitShort(classCastHandler);        // handler PC
+        exc.emitShort(nullPointerClass);        // catch type
+
+        exc.emitShort(invokeStartPC);           // start PC
+        exc.emitShort(invokeEndPC);             // end PC
+        exc.emitShort(invocationTargetHandler); // handler PC
+        exc.emitShort(throwableClass);          // catch type
+
+        emitMethod(invokeIdx, cb.getMaxLocals(), cb, exc,
+                   new short[] { invocationTargetClass });
+    }
+
+    private boolean usesPrimitiveTypes() {
+        // We need to emit boxing/unboxing constant pool information if
+        // the method takes a primitive type for any of its parameters or
+        // returns a primitive value (except void)
+        if (returnType.isPrimitive()) {
+            return true;
+        }
+        for (int i = 0; i < parameterTypes.length; i++) {
+            if (parameterTypes[i].isPrimitive()) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private int numNonPrimitiveParameterTypes() {
+        int num = 0;
+        for (int i = 0; i < parameterTypes.length; i++) {
+            if (!parameterTypes[i].isPrimitive()) {
+                ++num;
+            }
+        }
+        return num;
+    }
+
+    private boolean isInterface() {
+        return declaringClass.isInterface();
+    }
+
+    private String buildInternalSignature() {
+        StringBuilder sb = new StringBuilder();
+        sb.append("(");
+        for (int i = 0; i < parameterTypes.length; i++) {
+            sb.append(getClassName(parameterTypes[i], true));
+        }
+        sb.append(")");
+        sb.append(getClassName(returnType, true));
+        return sb.toString();
+    }
+
+    private static synchronized String generateName(boolean isConstructor,
+                                                    boolean forSerialization)
+    {
+        if (isConstructor) {
+            if (forSerialization) {
+                int num = ++serializationConstructorSymnum;
+                return "jdk/internal/reflect/GeneratedSerializationConstructorAccessor" + num;
+            } else {
+                int num = ++constructorSymnum;
+                return "jdk/internal/reflect/GeneratedConstructorAccessor" + num;
+            }
+        } else {
+            int num = ++methodSymnum;
+            return "jdk/internal/reflect/GeneratedMethodAccessor" + num;
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/MethodAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,48 @@
+/*
+ * 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 jdk.internal.reflect;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** <P> Package-private implementation of the MethodAccessor interface
+    which has access to all classes and all fields, regardless of
+    language restrictions. See MagicAccessor. </P>
+
+    <P> This class is known to the VM; do not change its name without
+    also changing the VM's code. </P>
+
+    <P> NOTE: ALL methods of subclasses are skipped during security
+    walks up the stack. The assumption is that the only such methods
+    that will persistently show up on the stack are the implementing
+    methods for java.lang.reflect.Method.invoke(). </P>
+*/
+
+abstract class MethodAccessorImpl extends MagicAccessorImpl
+    implements MethodAccessor {
+    /** Matches specification in {@link java.lang.reflect.Method} */
+    public abstract Object invoke(Object obj, Object[] args)
+        throws IllegalArgumentException, InvocationTargetException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/NativeConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.lang.reflect.*;
+import sun.reflect.misc.ReflectUtil;
+
+/** Used only for the first few invocations of a Constructor;
+    afterward, switches to bytecode-based implementation */
+
+class NativeConstructorAccessorImpl extends ConstructorAccessorImpl {
+    private final Constructor<?> c;
+    private DelegatingConstructorAccessorImpl parent;
+    private int numInvocations;
+
+    NativeConstructorAccessorImpl(Constructor<?> c) {
+        this.c = c;
+    }
+
+    public Object newInstance(Object[] args)
+        throws InstantiationException,
+               IllegalArgumentException,
+               InvocationTargetException
+    {
+        // We can't inflate a constructor belonging to a vm-anonymous class
+        // because that kind of class can't be referred to by name, hence can't
+        // be found from the generated bytecode.
+        if (++numInvocations > ReflectionFactory.inflationThreshold()
+                && !ReflectUtil.isVMAnonymousClass(c.getDeclaringClass())) {
+            ConstructorAccessorImpl acc = (ConstructorAccessorImpl)
+                new MethodAccessorGenerator().
+                    generateConstructor(c.getDeclaringClass(),
+                                        c.getParameterTypes(),
+                                        c.getExceptionTypes(),
+                                        c.getModifiers());
+            parent.setDelegate(acc);
+        }
+
+        return newInstance0(c, args);
+    }
+
+    void setParent(DelegatingConstructorAccessorImpl parent) {
+        this.parent = parent;
+    }
+
+    private static native Object newInstance0(Constructor<?> c, Object[] args)
+        throws InstantiationException,
+               IllegalArgumentException,
+               InvocationTargetException;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/NativeMethodAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.lang.reflect.*;
+import sun.reflect.misc.ReflectUtil;
+
+/** Used only for the first few invocations of a Method; afterward,
+    switches to bytecode-based implementation */
+
+class NativeMethodAccessorImpl extends MethodAccessorImpl {
+    private final Method method;
+    private DelegatingMethodAccessorImpl parent;
+    private int numInvocations;
+
+    NativeMethodAccessorImpl(Method method) {
+        this.method = method;
+    }
+
+    public Object invoke(Object obj, Object[] args)
+        throws IllegalArgumentException, InvocationTargetException
+    {
+        // We can't inflate methods belonging to vm-anonymous classes because
+        // that kind of class can't be referred to by name, hence can't be
+        // found from the generated bytecode.
+        if (++numInvocations > ReflectionFactory.inflationThreshold()
+                && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
+            MethodAccessorImpl acc = (MethodAccessorImpl)
+                new MethodAccessorGenerator().
+                    generateMethod(method.getDeclaringClass(),
+                                   method.getName(),
+                                   method.getParameterTypes(),
+                                   method.getReturnType(),
+                                   method.getExceptionTypes(),
+                                   method.getModifiers());
+            parent.setDelegate(acc);
+        }
+
+        return invoke0(method, obj, args);
+    }
+
+    void setParent(DelegatingMethodAccessorImpl parent) {
+        this.parent = parent;
+    }
+
+    private static native Object invoke0(Method m, Object obj, Object[] args);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/Reflection.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,425 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+
+import java.lang.reflect.*;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import jdk.internal.HotSpotIntrinsicCandidate;
+import jdk.internal.misc.VM;
+
+/** Common utility routines used by both java.lang and
+    java.lang.reflect */
+
+public class Reflection {
+
+    /** Used to filter out fields and methods from certain classes from public
+        view, where they are sensitive or they may contain VM-internal objects.
+        These Maps are updated very rarely. Rather than synchronize on
+        each access, we use copy-on-write */
+    private static volatile Map<Class<?>,String[]> fieldFilterMap;
+    private static volatile Map<Class<?>,String[]> methodFilterMap;
+
+    static {
+        Map<Class<?>,String[]> map = new HashMap<Class<?>,String[]>();
+        map.put(Reflection.class,
+            new String[] {"fieldFilterMap", "methodFilterMap"});
+        map.put(System.class, new String[] {"security"});
+        map.put(Class.class, new String[] {"classLoader"});
+        fieldFilterMap = map;
+
+        methodFilterMap = new HashMap<>();
+    }
+
+    /** Returns the class of the caller of the method calling this method,
+        ignoring frames associated with java.lang.reflect.Method.invoke()
+        and its implementation. */
+    @CallerSensitive
+    @HotSpotIntrinsicCandidate
+    public static native Class<?> getCallerClass();
+
+    /**
+     * @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(forRemoval=true)
+    public static native Class<?> getCallerClass(int depth);
+
+    /** Retrieves the access flags written to the class file. For
+        inner classes these flags may differ from those returned by
+        Class.getModifiers(), which searches the InnerClasses
+        attribute to find the source-level access flags. This is used
+        instead of Class.getModifiers() for run-time access checks due
+        to compatibility reasons; see 4471811. Only the values of the
+        low 13 bits (i.e., a mask of 0x1FFF) are guaranteed to be
+        valid. */
+    @HotSpotIntrinsicCandidate
+    public static native int getClassAccessFlags(Class<?> c);
+
+
+    public static void ensureMemberAccess(Class<?> currentClass,
+                                          Class<?> memberClass,
+                                          Object target,
+                                          int modifiers)
+        throws IllegalAccessException
+    {
+        if (currentClass == null || memberClass == null) {
+            throw new InternalError();
+        }
+
+        if (!verifyMemberAccess(currentClass, memberClass, target, modifiers)) {
+            throwIllegalAccessException(currentClass, memberClass, target, modifiers);
+        }
+    }
+
+    public static boolean verifyMemberAccess(Class<?> currentClass,
+                                             // Declaring class of field
+                                             // or method
+                                             Class<?> memberClass,
+                                             // May be NULL in case of statics
+                                             Object   target,
+                                             int      modifiers)
+    {
+        // Verify that currentClass can access a field, method, or
+        // constructor of memberClass, where that member's access bits are
+        // "modifiers".
+
+        boolean gotIsSameClassPackage = false;
+        boolean isSameClassPackage = false;
+
+        if (currentClass == memberClass) {
+            // Always succeeds
+            return true;
+        }
+
+        if (!verifyModuleAccess(currentClass, memberClass)) {
+            return false;
+        }
+
+        if (!Modifier.isPublic(getClassAccessFlags(memberClass))) {
+            isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+            gotIsSameClassPackage = true;
+            if (!isSameClassPackage) {
+                return false;
+            }
+        }
+
+        // At this point we know that currentClass can access memberClass.
+
+        if (Modifier.isPublic(modifiers)) {
+            return true;
+        }
+
+        boolean successSoFar = false;
+
+        if (Modifier.isProtected(modifiers)) {
+            // See if currentClass is a subclass of memberClass
+            if (isSubclassOf(currentClass, memberClass)) {
+                successSoFar = true;
+            }
+        }
+
+        if (!successSoFar && !Modifier.isPrivate(modifiers)) {
+            if (!gotIsSameClassPackage) {
+                isSameClassPackage = isSameClassPackage(currentClass,
+                                                        memberClass);
+                gotIsSameClassPackage = true;
+            }
+
+            if (isSameClassPackage) {
+                successSoFar = true;
+            }
+        }
+
+        if (!successSoFar) {
+            return false;
+        }
+
+        if (Modifier.isProtected(modifiers)) {
+            // Additional test for protected members: JLS 6.6.2
+            Class<?> targetClass = (target == null ? memberClass : target.getClass());
+            if (targetClass != currentClass) {
+                if (!gotIsSameClassPackage) {
+                    isSameClassPackage = isSameClassPackage(currentClass, memberClass);
+                    gotIsSameClassPackage = true;
+                }
+                if (!isSameClassPackage) {
+                    if (!isSubclassOf(targetClass, currentClass)) {
+                        return false;
+                    }
+                }
+            }
+        }
+
+        return true;
+    }
+
+    /**
+     * Returns {@code true} if memberClass's's module exports memberClass's
+     * package to currentClass's module.
+     */
+    public static boolean verifyModuleAccess(Class<?> currentClass,
+                                             Class<?> memberClass) {
+        return verifyModuleAccess(currentClass.getModule(), memberClass);
+    }
+
+    public static boolean verifyModuleAccess(Module currentModule, Class<?> memberClass) {
+        Module memberModule = memberClass.getModule();
+
+        // module may be null during startup (initLevel 0)
+        if (currentModule == memberModule)
+           return true;  // same module (named or unnamed)
+
+        // memberClass may be primitive or array class
+        Class<?> c = memberClass;
+        while (c.isArray()) {
+            c = c.getComponentType();
+        }
+        if (c.isPrimitive())
+            return true;
+
+        // check that memberModule exports the package to currentModule
+        return memberModule.isExported(c.getPackageName(), currentModule);
+    }
+
+    /**
+     * Returns true if two classes in the same package.
+     */
+    private static boolean isSameClassPackage(Class<?> c1, Class<?> c2) {
+        if (c1.getClassLoader() != c2.getClassLoader())
+            return false;
+        while (c1.isArray())
+            c1 = c1.getComponentType();
+        while (c2.isArray())
+            c2 = c2.getComponentType();
+        return Objects.equals(c1.getPackageName(), c2.getPackageName());
+    }
+
+    static boolean isSubclassOf(Class<?> queryClass,
+                                Class<?> ofClass)
+    {
+        while (queryClass != null) {
+            if (queryClass == ofClass) {
+                return true;
+            }
+            queryClass = queryClass.getSuperclass();
+        }
+        return false;
+    }
+
+    // fieldNames must contain only interned Strings
+    public static synchronized void registerFieldsToFilter(Class<?> containingClass,
+                                              String ... fieldNames) {
+        fieldFilterMap =
+            registerFilter(fieldFilterMap, containingClass, fieldNames);
+    }
+
+    // methodNames must contain only interned Strings
+    public static synchronized void registerMethodsToFilter(Class<?> containingClass,
+                                              String ... methodNames) {
+        methodFilterMap =
+            registerFilter(methodFilterMap, containingClass, methodNames);
+    }
+
+    private static Map<Class<?>,String[]> registerFilter(Map<Class<?>,String[]> map,
+            Class<?> containingClass, String ... names) {
+        if (map.get(containingClass) != null) {
+            throw new IllegalArgumentException
+                            ("Filter already registered: " + containingClass);
+        }
+        map = new HashMap<Class<?>,String[]>(map);
+        map.put(containingClass, names);
+        return map;
+    }
+
+    public static Field[] filterFields(Class<?> containingClass,
+                                       Field[] fields) {
+        if (fieldFilterMap == null) {
+            // Bootstrapping
+            return fields;
+        }
+        return (Field[])filter(fields, fieldFilterMap.get(containingClass));
+    }
+
+    public static Method[] filterMethods(Class<?> containingClass, Method[] methods) {
+        if (methodFilterMap == null) {
+            // Bootstrapping
+            return methods;
+        }
+        return (Method[])filter(methods, methodFilterMap.get(containingClass));
+    }
+
+    private static Member[] filter(Member[] members, String[] filteredNames) {
+        if ((filteredNames == null) || (members.length == 0)) {
+            return members;
+        }
+        int numNewMembers = 0;
+        for (Member member : members) {
+            boolean shouldSkip = false;
+            for (String filteredName : filteredNames) {
+                if (member.getName() == filteredName) {
+                    shouldSkip = true;
+                    break;
+                }
+            }
+            if (!shouldSkip) {
+                ++numNewMembers;
+            }
+        }
+        Member[] newMembers =
+            (Member[])Array.newInstance(members[0].getClass(), numNewMembers);
+        int destIdx = 0;
+        for (Member member : members) {
+            boolean shouldSkip = false;
+            for (String filteredName : filteredNames) {
+                if (member.getName() == filteredName) {
+                    shouldSkip = true;
+                    break;
+                }
+            }
+            if (!shouldSkip) {
+                newMembers[destIdx++] = member;
+            }
+        }
+        return newMembers;
+    }
+
+    /**
+     * Tests if the given method is caller-sensitive and the declaring class
+     * is defined by either the bootstrap class loader or platform class loader.
+     */
+    public static boolean isCallerSensitive(Method m) {
+        final ClassLoader loader = m.getDeclaringClass().getClassLoader();
+        if (VM.isSystemDomainLoader(loader) || isExtClassLoader(loader))  {
+            return m.isAnnotationPresent(CallerSensitive.class);
+        }
+        return false;
+    }
+
+    private static boolean isExtClassLoader(ClassLoader loader) {
+        ClassLoader cl = ClassLoader.getSystemClassLoader();
+        while (cl != null) {
+            if (cl.getParent() == null && cl == loader) {
+                return true;
+            }
+            cl = cl.getParent();
+        }
+        return false;
+    }
+
+
+    // true to print a stack trace when IAE is thrown
+    private static volatile boolean printStackWhenAccessFails;
+
+    // true if printStackWhenAccessFails has been initialized
+    private static volatile boolean printStackWhenAccessFailsSet;
+
+    private static void printStackTraceIfNeeded(Throwable e) {
+        if (!printStackWhenAccessFailsSet && VM.initLevel() >= 1) {
+            // can't use method reference here, might be too early in startup
+            PrivilegedAction<Boolean> pa = new PrivilegedAction<Boolean>() {
+                public Boolean run() {
+                    String s;
+                    s = System.getProperty("sun.reflect.debugModuleAccessChecks");
+                    return (s != null && !s.equalsIgnoreCase("false"));
+                }
+            };
+            printStackWhenAccessFails = AccessController.doPrivileged(pa);
+            printStackWhenAccessFailsSet = true;
+        }
+        if (printStackWhenAccessFails) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Throws IllegalAccessException with the an exception message based on
+     * the access that is denied.
+     */
+    private static void throwIllegalAccessException(Class<?> currentClass,
+                                                    Class<?> memberClass,
+                                                    Object target,
+                                                    int modifiers)
+        throws IllegalAccessException
+    {
+        String currentSuffix = "";
+        String memberSuffix = "";
+        Module m1 = currentClass.getModule();
+        if (m1.isNamed())
+            currentSuffix = " (in " + m1 + ")";
+        Module m2 = memberClass.getModule();
+        if (m2.isNamed())
+            memberSuffix = " (in " + m2 + ")";
+
+        Class<?> c = memberClass;
+        while (c.isArray()) {
+            c = c.getComponentType();
+        }
+        String memberPackageName = c.getPackageName();
+
+        String msg = currentClass + currentSuffix + " cannot access ";
+        if (m2.isExported(memberPackageName, m1)) {
+
+            // module access okay so include the modifiers in the message
+            msg += "a member of " + memberClass + memberSuffix +
+                    " with modifiers \"" + Modifier.toString(modifiers) + "\"";
+
+        } else {
+            // module access failed
+            msg += memberClass + memberSuffix+ " because "
+                   + m2 + " does not export " + memberPackageName;
+            if (m2.isNamed()) msg += " to " + m1;
+        }
+
+        throwIllegalAccessException(msg);
+    }
+
+    /**
+     * Throws IllegalAccessException with the given exception message.
+     */
+    public static void throwIllegalAccessException(String msg)
+        throws IllegalAccessException
+    {
+        IllegalAccessException e = new IllegalAccessException(msg);
+        printStackTraceIfNeeded(e);
+        throw e;
+    }
+
+    /**
+     * Throws InaccessibleObjectException with the given exception message.
+     */
+    public static void throwInaccessibleObjectException(String msg) {
+        InaccessibleObjectException e = new InaccessibleObjectException(msg);
+        printStackTraceIfNeeded(e);
+        throw e;
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/ReflectionFactory.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,432 @@
+/*
+ * Copyright (c) 2001, 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.  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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Executable;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import sun.reflect.misc.ReflectUtil;
+
+/** <P> The master factory for all reflective objects, both those in
+    java.lang.reflect (Fields, Methods, Constructors) as well as their
+    delegates (FieldAccessors, MethodAccessors, ConstructorAccessors).
+    </P>
+
+    <P> The methods in this class are extremely unsafe and can cause
+    subversion of both the language and the verifier. For this reason,
+    they are all instance methods, and access to the constructor of
+    this factory is guarded by a security check, in similar style to
+    {@link jdk.internal.misc.Unsafe}. </P>
+*/
+
+public class ReflectionFactory {
+
+    private static boolean initted = false;
+    private static final Permission reflectionFactoryAccessPerm
+        = new RuntimePermission("reflectionFactoryAccess");
+    private static final ReflectionFactory soleInstance = new ReflectionFactory();
+    // Provides access to package-private mechanisms in java.lang.reflect
+    private static volatile LangReflectAccess langReflectAccess;
+
+    //
+    // "Inflation" mechanism. Loading bytecodes to implement
+    // Method.invoke() and Constructor.newInstance() currently costs
+    // 3-4x more than an invocation via native code for the first
+    // invocation (though subsequent invocations have been benchmarked
+    // to be over 20x faster). Unfortunately this cost increases
+    // startup time for certain applications that use reflection
+    // intensively (but only once per class) to bootstrap themselves.
+    // To avoid this penalty we reuse the existing JVM entry points
+    // for the first few invocations of Methods and Constructors and
+    // then switch to the bytecode-based implementations.
+    //
+    // Package-private to be accessible to NativeMethodAccessorImpl
+    // and NativeConstructorAccessorImpl
+    private static boolean noInflation        = false;
+    private static int     inflationThreshold = 15;
+
+    private ReflectionFactory() {
+    }
+
+    /**
+     * A convenience class for acquiring the capability to instantiate
+     * reflective objects.  Use this instead of a raw call to {@link
+     * #getReflectionFactory} in order to avoid being limited by the
+     * permissions of your callers.
+     *
+     * <p>An instance of this class can be used as the argument of
+     * <code>AccessController.doPrivileged</code>.
+     */
+    public static final class GetReflectionFactoryAction
+        implements PrivilegedAction<ReflectionFactory> {
+        public ReflectionFactory run() {
+            return getReflectionFactory();
+        }
+    }
+
+    /**
+     * Provides the caller with the capability to instantiate reflective
+     * objects.
+     *
+     * <p> First, if there is a security manager, its
+     * <code>checkPermission</code> method is called with a {@link
+     * java.lang.RuntimePermission} with target
+     * <code>"reflectionFactoryAccess"</code>.  This may result in a
+     * security exception.
+     *
+     * <p> The returned <code>ReflectionFactory</code> 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.
+     *
+     * @exception SecurityException if a security manager exists and its
+     *             <code>checkPermission</code> method doesn't allow
+     *             access to the RuntimePermission "reflectionFactoryAccess".  */
+    public static ReflectionFactory getReflectionFactory() {
+        SecurityManager security = System.getSecurityManager();
+        if (security != null) {
+            // TO DO: security.checkReflectionFactoryAccess();
+            security.checkPermission(reflectionFactoryAccessPerm);
+        }
+        return soleInstance;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Routines used by java.lang.reflect
+    //
+    //
+
+    /** Called only by java.lang.reflect.Modifier's static initializer */
+    public void setLangReflectAccess(LangReflectAccess access) {
+        langReflectAccess = access;
+    }
+
+    /**
+     * Note: this routine can cause the declaring class for the field
+     * be initialized and therefore must not be called until the
+     * first get/set of this field.
+     * @param field the field
+     * @param override true if caller has overridden accessibility
+     */
+    public FieldAccessor newFieldAccessor(Field field, boolean override) {
+        checkInitted();
+        return UnsafeFieldAccessorFactory.newFieldAccessor(field, override);
+    }
+
+    public MethodAccessor newMethodAccessor(Method method) {
+        checkInitted();
+
+        if (noInflation && !ReflectUtil.isVMAnonymousClass(method.getDeclaringClass())) {
+            return new MethodAccessorGenerator().
+                generateMethod(method.getDeclaringClass(),
+                               method.getName(),
+                               method.getParameterTypes(),
+                               method.getReturnType(),
+                               method.getExceptionTypes(),
+                               method.getModifiers());
+        } else {
+            NativeMethodAccessorImpl acc =
+                new NativeMethodAccessorImpl(method);
+            DelegatingMethodAccessorImpl res =
+                new DelegatingMethodAccessorImpl(acc);
+            acc.setParent(res);
+            return res;
+        }
+    }
+
+    public ConstructorAccessor newConstructorAccessor(Constructor<?> c) {
+        checkInitted();
+
+        Class<?> declaringClass = c.getDeclaringClass();
+        if (Modifier.isAbstract(declaringClass.getModifiers())) {
+            return new InstantiationExceptionConstructorAccessorImpl(null);
+        }
+        if (declaringClass == Class.class) {
+            return new InstantiationExceptionConstructorAccessorImpl
+                ("Can not instantiate java.lang.Class");
+        }
+        // Bootstrapping issue: since we use Class.newInstance() in
+        // the ConstructorAccessor generation process, we have to
+        // break the cycle here.
+        if (Reflection.isSubclassOf(declaringClass,
+                                    ConstructorAccessorImpl.class)) {
+            return new BootstrapConstructorAccessorImpl(c);
+        }
+
+        if (noInflation && !ReflectUtil.isVMAnonymousClass(c.getDeclaringClass())) {
+            return new MethodAccessorGenerator().
+                generateConstructor(c.getDeclaringClass(),
+                                    c.getParameterTypes(),
+                                    c.getExceptionTypes(),
+                                    c.getModifiers());
+        } else {
+            NativeConstructorAccessorImpl acc =
+                new NativeConstructorAccessorImpl(c);
+            DelegatingConstructorAccessorImpl res =
+                new DelegatingConstructorAccessorImpl(acc);
+            acc.setParent(res);
+            return res;
+        }
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Routines used by java.lang
+    //
+    //
+
+    /** Creates a new java.lang.reflect.Field. Access checks as per
+        java.lang.reflect.AccessibleObject are not overridden. */
+    public Field newField(Class<?> declaringClass,
+                          String name,
+                          Class<?> type,
+                          int modifiers,
+                          int slot,
+                          String signature,
+                          byte[] annotations)
+    {
+        return langReflectAccess().newField(declaringClass,
+                                            name,
+                                            type,
+                                            modifiers,
+                                            slot,
+                                            signature,
+                                            annotations);
+    }
+
+    /** Creates a new java.lang.reflect.Method. Access checks as per
+        java.lang.reflect.AccessibleObject are not overridden. */
+    public Method newMethod(Class<?> declaringClass,
+                            String name,
+                            Class<?>[] parameterTypes,
+                            Class<?> returnType,
+                            Class<?>[] checkedExceptions,
+                            int modifiers,
+                            int slot,
+                            String signature,
+                            byte[] annotations,
+                            byte[] parameterAnnotations,
+                            byte[] annotationDefault)
+    {
+        return langReflectAccess().newMethod(declaringClass,
+                                             name,
+                                             parameterTypes,
+                                             returnType,
+                                             checkedExceptions,
+                                             modifiers,
+                                             slot,
+                                             signature,
+                                             annotations,
+                                             parameterAnnotations,
+                                             annotationDefault);
+    }
+
+    /** Creates a new java.lang.reflect.Constructor. Access checks as
+        per java.lang.reflect.AccessibleObject are not overridden. */
+    public Constructor<?> newConstructor(Class<?> declaringClass,
+                                         Class<?>[] parameterTypes,
+                                         Class<?>[] checkedExceptions,
+                                         int modifiers,
+                                         int slot,
+                                         String signature,
+                                         byte[] annotations,
+                                         byte[] parameterAnnotations)
+    {
+        return langReflectAccess().newConstructor(declaringClass,
+                                                  parameterTypes,
+                                                  checkedExceptions,
+                                                  modifiers,
+                                                  slot,
+                                                  signature,
+                                                  annotations,
+                                                  parameterAnnotations);
+    }
+
+    /** Gets the MethodAccessor object for a java.lang.reflect.Method */
+    public MethodAccessor getMethodAccessor(Method m) {
+        return langReflectAccess().getMethodAccessor(m);
+    }
+
+    /** Sets the MethodAccessor object for a java.lang.reflect.Method */
+    public void setMethodAccessor(Method m, MethodAccessor accessor) {
+        langReflectAccess().setMethodAccessor(m, accessor);
+    }
+
+    /** Gets the ConstructorAccessor object for a
+        java.lang.reflect.Constructor */
+    public ConstructorAccessor getConstructorAccessor(Constructor<?> c) {
+        return langReflectAccess().getConstructorAccessor(c);
+    }
+
+    /** Sets the ConstructorAccessor object for a
+        java.lang.reflect.Constructor */
+    public void setConstructorAccessor(Constructor<?> c,
+                                       ConstructorAccessor accessor)
+    {
+        langReflectAccess().setConstructorAccessor(c, accessor);
+    }
+
+    /** Makes a copy of the passed method. The returned method is a
+        "child" of the passed one; see the comments in Method.java for
+        details. */
+    public Method copyMethod(Method arg) {
+        return langReflectAccess().copyMethod(arg);
+    }
+
+    /** Makes a copy of the passed method. The returned method is NOT
+     * a "child" but a "sibling" of the Method in arg. Should only be
+     * used on non-root methods. */
+    public Method leafCopyMethod(Method arg) {
+        return langReflectAccess().leafCopyMethod(arg);
+    }
+
+
+    /** Makes a copy of the passed field. The returned field is a
+        "child" of the passed one; see the comments in Field.java for
+        details. */
+    public Field copyField(Field arg) {
+        return langReflectAccess().copyField(arg);
+    }
+
+    /** Makes a copy of the passed constructor. The returned
+        constructor is a "child" of the passed one; see the comments
+        in Constructor.java for details. */
+    public <T> Constructor<T> copyConstructor(Constructor<T> arg) {
+        return langReflectAccess().copyConstructor(arg);
+    }
+
+    /** Gets the byte[] that encodes TypeAnnotations on an executable.
+     */
+    public byte[] getExecutableTypeAnnotationBytes(Executable ex) {
+        return langReflectAccess().getExecutableTypeAnnotationBytes(ex);
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Routines used by serialization
+    //
+    //
+
+    public Constructor<?> newConstructorForSerialization
+        (Class<?> classToInstantiate, Constructor<?> constructorToCall)
+    {
+        // Fast path
+        if (constructorToCall.getDeclaringClass() == classToInstantiate) {
+            return constructorToCall;
+        }
+
+        ConstructorAccessor acc = new MethodAccessorGenerator().
+            generateSerializationConstructor(classToInstantiate,
+                                             constructorToCall.getParameterTypes(),
+                                             constructorToCall.getExceptionTypes(),
+                                             constructorToCall.getModifiers(),
+                                             constructorToCall.getDeclaringClass());
+        Constructor<?> c = newConstructor(constructorToCall.getDeclaringClass(),
+                                          constructorToCall.getParameterTypes(),
+                                          constructorToCall.getExceptionTypes(),
+                                          constructorToCall.getModifiers(),
+                                          langReflectAccess().
+                                          getConstructorSlot(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorSignature(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorAnnotations(constructorToCall),
+                                          langReflectAccess().
+                                          getConstructorParameterAnnotations(constructorToCall));
+        setConstructorAccessor(c, acc);
+        return c;
+    }
+
+    //--------------------------------------------------------------------------
+    //
+    // Internals only below this point
+    //
+
+    static int inflationThreshold() {
+        return inflationThreshold;
+    }
+
+    /** We have to defer full initialization of this class until after
+        the static initializer is run since java.lang.reflect.Method's
+        static initializer (more properly, that for
+        java.lang.reflect.AccessibleObject) causes this class's to be
+        run, before the system properties are set up. */
+    private static void checkInitted() {
+        if (initted) return;
+        AccessController.doPrivileged(
+            new PrivilegedAction<>() {
+                public Void run() {
+                    // Tests to ensure the system properties table is fully
+                    // initialized. This is needed because reflection code is
+                    // called very early in the initialization process (before
+                    // command-line arguments have been parsed and therefore
+                    // these user-settable properties installed.) We assume that
+                    // if System.out is non-null then the System class has been
+                    // fully initialized and that the bulk of the startup code
+                    // has been run.
+
+                    if (System.out == null) {
+                        // java.lang.System not yet fully initialized
+                        return null;
+                    }
+
+                    String val = System.getProperty("sun.reflect.noInflation");
+                    if (val != null && val.equals("true")) {
+                        noInflation = true;
+                    }
+
+                    val = System.getProperty("sun.reflect.inflationThreshold");
+                    if (val != null) {
+                        try {
+                            inflationThreshold = Integer.parseInt(val);
+                        } catch (NumberFormatException e) {
+                            throw new RuntimeException("Unable to parse property sun.reflect.inflationThreshold", e);
+                        }
+                    }
+
+                    initted = true;
+                    return null;
+                }
+            });
+    }
+
+    private static LangReflectAccess langReflectAccess() {
+        if (langReflectAccess == null) {
+            // Call a static method to get class java.lang.reflect.Modifier
+            // initialized. Its static initializer will cause
+            // setLangReflectAccess() to be called from the context of the
+            // java.lang.reflect package.
+            Modifier.isPublic(Modifier.PUBLIC);
+        }
+        return langReflectAccess;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/SerializationConstructorAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,45 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** <P> Java serialization (in java.io) expects to be able to
+    instantiate a class and invoke a no-arg constructor of that
+    class's first non-Serializable superclass. This is not a valid
+    operation according to the VM specification; one can not (for
+    classes A and B, where B is a subclass of A) write "new B;
+    invokespecial A()" without getting a verification error. </P>
+
+    <P> In all other respects, the bytecode-based reflection framework
+    can be reused for this purpose. This marker class was originally
+    known to the VM and verification disabled for it and all
+    subclasses, but the bug fix for 4486457 necessitated disabling
+    verification for all of the dynamically-generated bytecodes
+    associated with reflection. This class has been left in place to
+    make future debugging easier. </P> */
+
+abstract class SerializationConstructorAccessorImpl
+    extends ConstructorAccessorImpl {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/SignatureIterator.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,81 @@
+/*
+ * 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 jdk.internal.reflect;
+
+/** Assists in iterating down a method's signature */
+
+class SignatureIterator {
+    private final String sig;
+    private int idx;
+
+    public SignatureIterator(String sig) {
+        this.sig = sig;
+        reset();
+    }
+
+    public void reset() {
+        idx = 1;
+    }
+
+    public boolean atEnd() {
+        return sig.charAt(idx) == ')';
+    }
+
+    public String next() {
+        if (atEnd()) return null;
+        char c = sig.charAt(idx);
+        if (c != '[' && c != 'L') {
+            ++idx;
+            return new String(new char[] { c });
+        }
+        // Walk forward to end of entry
+        int endIdx = idx;
+        if (c == '[') {
+            while ((c = sig.charAt(endIdx)) == '[') {
+                endIdx++;
+            }
+        }
+
+        if (c == 'L') {
+            while (sig.charAt(endIdx) != ';') {
+                endIdx++;
+            }
+        }
+
+        int beginIdx = idx;
+        idx = endIdx + 1;
+        return sig.substring(beginIdx, idx);
+    }
+
+    /** Should only be called when atEnd() is true. Does not change
+        state of iterator. */
+    public String returnType() {
+        if (!atEnd()) {
+            throw new InternalError("Illegal use of SignatureIterator");
+        }
+        return sig.substring(idx + 1, sig.length());
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UTF8.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2001, 2011, 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 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
+    Class.newInstance(). */
+
+class UTF8 {
+    // This encoder is not quite correct.  It does not handle surrogate pairs.
+    static byte[] encode(String str) {
+        int len = str.length();
+        byte[] res = new byte[utf8Length(str)];
+        int utf8Idx = 0;
+        try {
+            for (int i = 0; i < len; i++) {
+                int c = str.charAt(i) & 0xFFFF;
+                if (c >= 0x0001 && c <= 0x007F) {
+                    res[utf8Idx++] = (byte) c;
+                } else if (c == 0x0000 ||
+                           (c >= 0x0080 && c <= 0x07FF)) {
+                    res[utf8Idx++] = (byte) (0xC0 + (c >> 6));
+                    res[utf8Idx++] = (byte) (0x80 + (c & 0x3F));
+                } else {
+                    res[utf8Idx++] = (byte) (0xE0 + (c >> 12));
+                    res[utf8Idx++] = (byte) (0x80 + ((c >> 6) & 0x3F));
+                    res[utf8Idx++] = (byte) (0x80 + (c & 0x3F));
+                }
+            }
+        } catch (ArrayIndexOutOfBoundsException e) {
+            throw new InternalError
+                ("Bug in sun.reflect bootstrap UTF-8 encoder", e);
+        }
+        return res;
+    }
+
+    private static int utf8Length(String str) {
+        int len = str.length();
+        int utf8Len = 0;
+        for (int i = 0; i < len; i++) {
+            int c = str.charAt(i) & 0xFFFF;
+            if (c >= 0x0001 && c <= 0x007F) {
+                utf8Len += 1;
+            } else if (c == 0x0000 ||
+                       (c >= 0x0080 && c <= 0x07FF)) {
+                utf8Len += 2;
+            } else {
+                utf8Len += 3;
+            }
+        }
+        return utf8Len;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeBooleanFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeBooleanFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeBooleanFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Boolean.valueOf(getBoolean(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getBoolean(obj, fieldOffset);
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        throw newGetDoubleIllegalArgumentException();
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Boolean) {
+            unsafe.putBoolean(obj, fieldOffset, ((Boolean) value).booleanValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(z);
+        }
+        unsafe.putBoolean(obj, fieldOffset, z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeByteFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeByteFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeByteFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Byte.valueOf(getByte(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getByte(obj, fieldOffset);
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putByte(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(b);
+        }
+        unsafe.putByte(obj, fieldOffset, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeCharacterFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeCharacterFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeCharacterFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Character.valueOf(getChar(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getChar(obj, fieldOffset);
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Character) {
+            unsafe.putChar(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(c);
+        }
+        unsafe.putChar(obj, fieldOffset, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeDoubleFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeDoubleFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeDoubleFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Double.valueOf(getDouble(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getDouble(obj, fieldOffset);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putDouble(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putDouble(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putDouble(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putDouble(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putDouble(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        if (value instanceof Float) {
+            unsafe.putDouble(obj, fieldOffset, ((Float) value).floatValue());
+            return;
+        }
+        if (value instanceof Double) {
+            unsafe.putDouble(obj, fieldOffset, ((Double) value).doubleValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(d);
+        }
+        unsafe.putDouble(obj, fieldOffset, d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorFactory.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2001, 2011, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+
+class UnsafeFieldAccessorFactory {
+    static FieldAccessor newFieldAccessor(Field field, boolean override) {
+        Class<?> type = field.getType();
+        boolean isStatic = Modifier.isStatic(field.getModifiers());
+        boolean isFinal = Modifier.isFinal(field.getModifiers());
+        boolean isVolatile = Modifier.isVolatile(field.getModifiers());
+        boolean isQualified = isFinal || isVolatile;
+        boolean isReadOnly = isFinal && (isStatic || !override);
+        if (isStatic) {
+            // This code path does not guarantee that the field's
+            // declaring class has been initialized, but it must be
+            // before performing reflective operations.
+            UnsafeFieldAccessorImpl.unsafe.ensureClassInitialized(field.getDeclaringClass());
+
+            if (!isQualified) {
+                if (type == Boolean.TYPE) {
+                    return new UnsafeStaticBooleanFieldAccessorImpl(field);
+                } else if (type == Byte.TYPE) {
+                    return new UnsafeStaticByteFieldAccessorImpl(field);
+                } else if (type == Short.TYPE) {
+                    return new UnsafeStaticShortFieldAccessorImpl(field);
+                } else if (type == Character.TYPE) {
+                    return new UnsafeStaticCharacterFieldAccessorImpl(field);
+                } else if (type == Integer.TYPE) {
+                    return new UnsafeStaticIntegerFieldAccessorImpl(field);
+                } else if (type == Long.TYPE) {
+                    return new UnsafeStaticLongFieldAccessorImpl(field);
+                } else if (type == Float.TYPE) {
+                    return new UnsafeStaticFloatFieldAccessorImpl(field);
+                } else if (type == Double.TYPE) {
+                    return new UnsafeStaticDoubleFieldAccessorImpl(field);
+                } else {
+                    return new UnsafeStaticObjectFieldAccessorImpl(field);
+                }
+            } else {
+                if (type == Boolean.TYPE) {
+                    return new UnsafeQualifiedStaticBooleanFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Byte.TYPE) {
+                    return new UnsafeQualifiedStaticByteFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Short.TYPE) {
+                    return new UnsafeQualifiedStaticShortFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Character.TYPE) {
+                    return new UnsafeQualifiedStaticCharacterFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Integer.TYPE) {
+                    return new UnsafeQualifiedStaticIntegerFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Long.TYPE) {
+                    return new UnsafeQualifiedStaticLongFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Float.TYPE) {
+                    return new UnsafeQualifiedStaticFloatFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Double.TYPE) {
+                    return new UnsafeQualifiedStaticDoubleFieldAccessorImpl(field, isReadOnly);
+                } else {
+                    return new UnsafeQualifiedStaticObjectFieldAccessorImpl(field, isReadOnly);
+                }
+            }
+        } else {
+            if (!isQualified) {
+                if (type == Boolean.TYPE) {
+                    return new UnsafeBooleanFieldAccessorImpl(field);
+                } else if (type == Byte.TYPE) {
+                    return new UnsafeByteFieldAccessorImpl(field);
+                } else if (type == Short.TYPE) {
+                    return new UnsafeShortFieldAccessorImpl(field);
+                } else if (type == Character.TYPE) {
+                    return new UnsafeCharacterFieldAccessorImpl(field);
+                } else if (type == Integer.TYPE) {
+                    return new UnsafeIntegerFieldAccessorImpl(field);
+                } else if (type == Long.TYPE) {
+                    return new UnsafeLongFieldAccessorImpl(field);
+                } else if (type == Float.TYPE) {
+                    return new UnsafeFloatFieldAccessorImpl(field);
+                } else if (type == Double.TYPE) {
+                    return new UnsafeDoubleFieldAccessorImpl(field);
+                } else {
+                    return new UnsafeObjectFieldAccessorImpl(field);
+                }
+            } else {
+                if (type == Boolean.TYPE) {
+                    return new UnsafeQualifiedBooleanFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Byte.TYPE) {
+                    return new UnsafeQualifiedByteFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Short.TYPE) {
+                    return new UnsafeQualifiedShortFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Character.TYPE) {
+                    return new UnsafeQualifiedCharacterFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Integer.TYPE) {
+                    return new UnsafeQualifiedIntegerFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Long.TYPE) {
+                    return new UnsafeQualifiedLongFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Float.TYPE) {
+                    return new UnsafeQualifiedFloatFieldAccessorImpl(field, isReadOnly);
+                } else if (type == Double.TYPE) {
+                    return new UnsafeQualifiedDoubleFieldAccessorImpl(field, isReadOnly);
+                } else {
+                    return new UnsafeQualifiedObjectFieldAccessorImpl(field, isReadOnly);
+                }
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2001, 2011, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import jdk.internal.misc.Unsafe;
+
+/** Base class for jdk.internal.misc.Unsafe-based FieldAccessors. The
+    observation is that there are only nine types of fields from the
+    standpoint of reflection code: the eight primitive types and
+    Object. Using class Unsafe instead of generated bytecodes saves
+    memory and loading time for the dynamically-generated
+    FieldAccessors. */
+
+abstract class UnsafeFieldAccessorImpl extends FieldAccessorImpl {
+    static final Unsafe unsafe = Unsafe.getUnsafe();
+
+    protected final Field   field;
+    protected final long    fieldOffset;
+    protected final boolean isFinal;
+
+    UnsafeFieldAccessorImpl(Field field) {
+        this.field = field;
+        if (Modifier.isStatic(field.getModifiers()))
+            fieldOffset = unsafe.staticFieldOffset(field);
+        else
+            fieldOffset = unsafe.objectFieldOffset(field);
+        isFinal = Modifier.isFinal(field.getModifiers());
+    }
+
+    protected void ensureObj(Object o) {
+        // NOTE: will throw NullPointerException, as specified, if o is null
+        if (!field.getDeclaringClass().isAssignableFrom(o.getClass())) {
+            throwSetIllegalArgumentException(o);
+        }
+    }
+
+    private String getQualifiedFieldName() {
+      return field.getDeclaringClass().getName() + "." +field.getName();
+    }
+
+    protected IllegalArgumentException newGetIllegalArgumentException(String type) {
+        return new IllegalArgumentException(
+          "Attempt to get "+field.getType().getName()+" field \"" +
+          getQualifiedFieldName() + "\" with illegal data type conversion to "+type
+        );
+    }
+
+    protected void throwFinalFieldIllegalAccessException(String attemptedType,
+                                                         String attemptedValue)
+                                                         throws IllegalAccessException {
+        throw new IllegalAccessException(getSetMessage(attemptedType, attemptedValue));
+
+    }
+    protected void throwFinalFieldIllegalAccessException(Object o) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException(o != null ? o.getClass().getName() : "", "");
+    }
+
+    protected void throwFinalFieldIllegalAccessException(boolean z) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("boolean", Boolean.toString(z));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(char b) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("char", Character.toString(b));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(byte b) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("byte", Byte.toString(b));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(short b) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("short", Short.toString(b));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(int i) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("int", Integer.toString(i));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(long i) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("long", Long.toString(i));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(float f) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("float", Float.toString(f));
+    }
+
+    protected void throwFinalFieldIllegalAccessException(double f) throws IllegalAccessException {
+        throwFinalFieldIllegalAccessException("double", Double.toString(f));
+    }
+
+    protected IllegalArgumentException newGetBooleanIllegalArgumentException() {
+        return newGetIllegalArgumentException("boolean");
+    }
+
+    protected IllegalArgumentException newGetByteIllegalArgumentException() {
+        return newGetIllegalArgumentException("byte");
+    }
+
+    protected IllegalArgumentException newGetCharIllegalArgumentException() {
+        return newGetIllegalArgumentException("char");
+    }
+
+    protected IllegalArgumentException newGetShortIllegalArgumentException() {
+        return newGetIllegalArgumentException("short");
+    }
+
+    protected IllegalArgumentException newGetIntIllegalArgumentException() {
+        return newGetIllegalArgumentException("int");
+    }
+
+    protected IllegalArgumentException newGetLongIllegalArgumentException() {
+        return newGetIllegalArgumentException("long");
+    }
+
+    protected IllegalArgumentException newGetFloatIllegalArgumentException() {
+        return newGetIllegalArgumentException("float");
+    }
+
+    protected IllegalArgumentException newGetDoubleIllegalArgumentException() {
+        return newGetIllegalArgumentException("double");
+    }
+
+    protected String getSetMessage(String attemptedType, String attemptedValue) {
+        String err = "Can not set";
+        if (Modifier.isStatic(field.getModifiers()))
+            err += " static";
+        if (isFinal)
+            err += " final";
+        err += " " + field.getType().getName() + " field " + getQualifiedFieldName() + " to ";
+        if (attemptedValue.length() > 0) {
+            err += "(" + attemptedType + ")" + attemptedValue;
+        } else {
+            if (attemptedType.length() > 0)
+                err += attemptedType;
+            else
+                err += "null value";
+        }
+        return err;
+    }
+
+    protected void throwSetIllegalArgumentException(String attemptedType,
+                                                    String attemptedValue) {
+        throw new IllegalArgumentException(getSetMessage(attemptedType,attemptedValue));
+    }
+
+    protected void throwSetIllegalArgumentException(Object o) {
+        throwSetIllegalArgumentException(o != null ? o.getClass().getName() : "", "");
+    }
+
+    protected void throwSetIllegalArgumentException(boolean b) {
+        throwSetIllegalArgumentException("boolean", Boolean.toString(b));
+    }
+
+    protected void throwSetIllegalArgumentException(byte b) {
+        throwSetIllegalArgumentException("byte", Byte.toString(b));
+    }
+
+    protected void throwSetIllegalArgumentException(char c) {
+        throwSetIllegalArgumentException("char", Character.toString(c));
+    }
+
+    protected void throwSetIllegalArgumentException(short s) {
+        throwSetIllegalArgumentException("short", Short.toString(s));
+    }
+
+    protected void throwSetIllegalArgumentException(int i) {
+        throwSetIllegalArgumentException("int", Integer.toString(i));
+    }
+
+    protected void throwSetIllegalArgumentException(long l) {
+        throwSetIllegalArgumentException("long", Long.toString(l));
+    }
+
+    protected void throwSetIllegalArgumentException(float f) {
+        throwSetIllegalArgumentException("float", Float.toString(f));
+    }
+
+    protected void throwSetIllegalArgumentException(double d) {
+        throwSetIllegalArgumentException("double", Double.toString(d));
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeFloatFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeFloatFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeFloatFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Float.valueOf(getFloat(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getFloat(obj, fieldOffset);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getFloat(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putFloat(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putFloat(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putFloat(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putFloat(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putFloat(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        if (value instanceof Float) {
+            unsafe.putFloat(obj, fieldOffset, ((Float) value).floatValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(f);
+        }
+        unsafe.putFloat(obj, fieldOffset, f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeIntegerFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeIntegerFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeIntegerFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Integer.valueOf(getInt(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getInt(obj, fieldOffset);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putInt(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putInt(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putInt(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putInt(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(i);
+        }
+        unsafe.putInt(obj, fieldOffset, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeLongFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeLongFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeLongFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Long.valueOf(getLong(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getLong(obj, fieldOffset);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getLong(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getLong(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putLong(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putLong(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putLong(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putLong(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putLong(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(l);
+        }
+        unsafe.putLong(obj, fieldOffset, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeObjectFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2001, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeObjectFieldAccessorImpl extends UnsafeFieldAccessorImpl {
+    UnsafeObjectFieldAccessorImpl(Field field) {
+        super(field);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getObject(obj, fieldOffset);
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        throw newGetDoubleIllegalArgumentException();
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isFinal) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value != null) {
+            if (!field.getType().isAssignableFrom(value.getClass())) {
+                throwSetIllegalArgumentException(value);
+            }
+        }
+        unsafe.putObject(obj, fieldOffset, value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedBooleanFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedBooleanFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedBooleanFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Boolean.valueOf(getBoolean(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getBooleanVolatile(obj, fieldOffset);
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        throw newGetDoubleIllegalArgumentException();
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Boolean) {
+            unsafe.putBooleanVolatile(obj, fieldOffset, ((Boolean) value).booleanValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(z);
+        }
+        unsafe.putBooleanVolatile(obj, fieldOffset, z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedByteFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedByteFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedByteFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Byte.valueOf(getByte(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getByteVolatile(obj, fieldOffset);
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putByteVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(b);
+        }
+        unsafe.putByteVolatile(obj, fieldOffset, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedCharacterFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedCharacterFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedCharacterFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Character.valueOf(getChar(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getCharVolatile(obj, fieldOffset);
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Character) {
+            unsafe.putCharVolatile(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(c);
+        }
+        unsafe.putCharVolatile(obj, fieldOffset, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedDoubleFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,166 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedDoubleFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedDoubleFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Double.valueOf(getDouble(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getDoubleVolatile(obj, fieldOffset);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        if (value instanceof Float) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Float) value).floatValue());
+            return;
+        }
+        if (value instanceof Double) {
+            unsafe.putDoubleVolatile(obj, fieldOffset, ((Double) value).doubleValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setDouble(obj, f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(d);
+        }
+        unsafe.putDoubleVolatile(obj, fieldOffset, d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2004, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import jdk.internal.misc.Unsafe;
+
+/**
+ * Base class for jdk.internal.misc.Unsafe-based FieldAccessors for fields with
+ * final or volatile qualifiers. These differ from unqualified
+ * versions in that (1) they check for read-only status (2) they use
+ * the volatile forms of Unsafe get/put methods. (When accessed via
+ * reflection, finals act as slightly "lighter" forms of volatiles. So
+ * the volatile forms are heavier than necessary in terms of
+ * underlying reordering rules and memory barriers, but preserve
+ * correctness.)
+ */
+
+abstract class UnsafeQualifiedFieldAccessorImpl
+    extends UnsafeFieldAccessorImpl
+{
+    protected final boolean isReadOnly;
+
+    UnsafeQualifiedFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field);
+        this.isReadOnly = isReadOnly;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedFloatFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedFloatFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedFloatFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Float.valueOf(getFloat(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getFloatVolatile(obj, fieldOffset);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getFloat(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        if (value instanceof Float) {
+            unsafe.putFloatVolatile(obj, fieldOffset, ((Float) value).floatValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setFloat(obj, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(f);
+        }
+        unsafe.putFloatVolatile(obj, fieldOffset, f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedIntegerFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedIntegerFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedIntegerFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Integer.valueOf(getInt(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getIntVolatile(obj, fieldOffset);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getInt(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putIntVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putIntVolatile(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putIntVolatile(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putIntVolatile(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setInt(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(i);
+        }
+        unsafe.putIntVolatile(obj, fieldOffset, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedLongFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedLongFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedLongFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Long.valueOf(getLong(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getLongVolatile(obj, fieldOffset);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getLong(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getLong(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putLongVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putLongVolatile(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        if (value instanceof Character) {
+            unsafe.putLongVolatile(obj, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        if (value instanceof Integer) {
+            unsafe.putLongVolatile(obj, fieldOffset, ((Integer) value).intValue());
+            return;
+        }
+        if (value instanceof Long) {
+            unsafe.putLongVolatile(obj, fieldOffset, ((Long) value).longValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setLong(obj, i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(l);
+        }
+        unsafe.putLongVolatile(obj, fieldOffset, l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedObjectFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedObjectFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedObjectFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getObjectVolatile(obj, fieldOffset);
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        throw newGetDoubleIllegalArgumentException();
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value != null) {
+            if (!field.getType().isAssignableFrom(value.getClass())) {
+                throwSetIllegalArgumentException(value);
+            }
+        }
+        unsafe.putObjectVolatile(obj, fieldOffset, value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedShortFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedShortFieldAccessorImpl
+    extends UnsafeQualifiedFieldAccessorImpl
+{
+    UnsafeQualifiedShortFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Short.valueOf(getShort(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        ensureObj(obj);
+        return unsafe.getShortVolatile(obj, fieldOffset);
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getShort(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getShort(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getShort(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getShort(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putShortVolatile(obj, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        if (value instanceof Short) {
+            unsafe.putShortVolatile(obj, fieldOffset, ((Short) value).shortValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        setShort(obj, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        ensureObj(obj);
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(s);
+        }
+        unsafe.putShortVolatile(obj, fieldOffset, s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticBooleanFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedStaticBooleanFieldAccessorImpl
+    extends UnsafeQualifiedStaticFieldAccessorImpl
+{
+    UnsafeQualifiedStaticBooleanFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Boolean.valueOf(getBoolean(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        return unsafe.getBooleanVolatile(base, fieldOffset);
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        throw newGetDoubleIllegalArgumentException();
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Boolean) {
+            unsafe.putBooleanVolatile(base, fieldOffset, ((Boolean) value).booleanValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(z);
+        }
+        unsafe.putBooleanVolatile(base, fieldOffset, z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticByteFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedStaticByteFieldAccessorImpl
+    extends UnsafeQualifiedStaticFieldAccessorImpl
+{
+    UnsafeQualifiedStaticByteFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Byte.valueOf(getByte(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        return unsafe.getByteVolatile(base, fieldOffset);
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getByte(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Byte) {
+            unsafe.putByteVolatile(base, fieldOffset, ((Byte) value).byteValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(b);
+        }
+        unsafe.putByteVolatile(base, fieldOffset, b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticCharacterFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedStaticCharacterFieldAccessorImpl
+    extends UnsafeQualifiedStaticFieldAccessorImpl
+{
+    UnsafeQualifiedStaticCharacterFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Character.valueOf(getChar(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        return unsafe.getCharVolatile(base, fieldOffset);
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return getChar(obj);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(value);
+        }
+        if (value == null) {
+            throwSetIllegalArgumentException(value);
+        }
+        if (value instanceof Character) {
+            unsafe.putCharVolatile(base, fieldOffset, ((Character) value).charValue());
+            return;
+        }
+        throwSetIllegalArgumentException(value);
+    }
+
+    public void setBoolean(Object obj, boolean z)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(z);
+    }
+
+    public void setByte(Object obj, byte b)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(b);
+    }
+
+    public void setChar(Object obj, char c)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        if (isReadOnly) {
+            throwFinalFieldIllegalAccessException(c);
+        }
+        unsafe.putCharVolatile(base, fieldOffset, c);
+    }
+
+    public void setShort(Object obj, short s)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(s);
+    }
+
+    public void setInt(Object obj, int i)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(i);
+    }
+
+    public void setLong(Object obj, long l)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(l);
+    }
+
+    public void setFloat(Object obj, float f)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(f);
+    }
+
+    public void setDouble(Object obj, double d)
+        throws IllegalArgumentException, IllegalAccessException
+    {
+        throwSetIllegalArgumentException(d);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.base/share/classes/jdk/internal/reflect/UnsafeQualifiedStaticDoubleFieldAccessorImpl.java	Fri Apr 15 16:19:15 2016 +0100
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2004, 2005, 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 jdk.internal.reflect;
+
+import java.lang.reflect.Field;
+
+class UnsafeQualifiedStaticDoubleFieldAccessorImpl
+    extends UnsafeQualifiedStaticFieldAccessorImpl
+{
+    UnsafeQualifiedStaticDoubleFieldAccessorImpl(Field field, boolean isReadOnly) {
+        super(field, isReadOnly);
+    }
+
+    public Object get(Object obj) throws IllegalArgumentException {
+        return Double.valueOf(getDouble(obj));
+    }
+
+    public boolean getBoolean(Object obj) throws IllegalArgumentException {
+        throw newGetBooleanIllegalArgumentException();
+    }
+
+    public byte getByte(Object obj) throws IllegalArgumentException {
+        throw newGetByteIllegalArgumentException();
+    }
+
+    public char getChar(Object obj) throws IllegalArgumentException {
+        throw newGetCharIllegalArgumentException();
+    }
+
+    public short getShort(Object obj) throws IllegalArgumentException {
+        throw newGetShortIllegalArgumentException();
+    }
+
+    public int getInt(Object obj) throws IllegalArgumentException {
+        throw newGetIntIllegalArgumentException();
+    }
+
+    public long getLong(Object obj) throws IllegalArgumentException {
+        throw newGetLongIllegalArgumentException();
+    }
+
+    public float getFloat(Object obj) throws IllegalArgumentException {
+        throw newGetFloatIllegalArgumentException();
+    }
+
+    public double getDouble(Object obj) throws IllegalArgumentException {
+        return unsafe.getDoubleVolatile(base, fieldOffset);
+    }
+
+    public void set(Object obj, Object value)
+        throws IllegalArgumentException, IllegalAccessException
+    {