--- old/src/java.base/share/classes/jdk/internal/misc/Unsafe.java 2016-04-08 18:52:03.000000000 +0300 +++ new/src/java.base/share/classes/jdk/internal/misc/Unsafe.java 2016-04-08 18:52:03.000000000 +0300 @@ -28,6 +28,7 @@ import java.lang.reflect.Field; import java.security.ProtectionDomain; +import jdk.internal.vm.annotation.ForceInline; import sun.reflect.CallerSensitive; import sun.reflect.Reflection; import jdk.internal.misc.VM; @@ -1157,9 +1158,17 @@ * Allocates an instance but does not run any constructor. * Initializes the class if it has not yet been. */ + @ForceInline + public Object allocateInstance(Class cls) throws InstantiationException { + // Interfaces and abstract classes are handled by the intrinsic. + if (cls.isPrimitive() || cls.isArray()) { + throw new InstantiationException(cls.getName()); + } + return allocateInstance0(cls); + } + @HotSpotIntrinsicCandidate - public native Object allocateInstance(Class cls) - throws InstantiationException; + private native Object allocateInstance0(Class cls) throws InstantiationException; /** * Allocates an array of a given type, but does not do zeroing.