src/java.base/share/classes/jdk/internal/misc/Unsafe.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File
*** old/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Apr  8 18:52:03 2016
--- new/src/java.base/share/classes/jdk/internal/misc/Unsafe.java	Fri Apr  8 18:52:03 2016

*** 26,35 **** --- 26,36 ---- package jdk.internal.misc; 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; import jdk.internal.HotSpotIntrinsicCandidate;
*** 1155,1167 **** --- 1156,1176 ---- /** * 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. * <p> * This method should only be used in the very rare cases where a high-performance code

src/java.base/share/classes/jdk/internal/misc/Unsafe.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File