changeset 5483:7c14a2225485

7188911: nightly failures after JSR 292 lazy method handle update (round 2) Reviewed-by: kvn, jrose
author twisti
date Tue, 07 Aug 2012 14:31:52 -0700
parents 6e34c6d3479f
children 3730065d89b9
files src/share/classes/java/lang/invoke/BoundMethodHandle.java src/share/classes/java/lang/invoke/MemberName.java
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue Jul 24 10:47:44 2012 -0700
+++ b/src/share/classes/java/lang/invoke/BoundMethodHandle.java	Tue Aug 07 14:31:52 2012 -0700
@@ -411,11 +411,11 @@
             SpeciesData d = lookupCache(types);
             if (!d.isPlaceholder())
                 return d;
-            Class<? extends BoundMethodHandle> cbmh;
             synchronized (d) {
                 // Use synch. on the placeholder to prevent multiple instantiation of one species.
                 // Creating this class forces a recursive call to getForClass.
-                cbmh = Factory.generateConcreteBMHClass(types);
+                if (lookupCache(types).isPlaceholder())
+                    Factory.generateConcreteBMHClass(types);
             }
             // Reacquire cache lock.
             d = lookupCache(types);
--- a/src/share/classes/java/lang/invoke/MemberName.java	Tue Jul 24 10:47:44 2012 -0700
+++ b/src/share/classes/java/lang/invoke/MemberName.java	Tue Aug 07 14:31:52 2012 -0700
@@ -476,6 +476,7 @@
     }
     @SuppressWarnings("LeakingThisInConstructor")
     public MemberName(Method m, boolean wantSpecial) {
+        m.getClass();  // NPE check
         // fill in vmtarget, vmindex while we have m in hand:
         MethodHandleNatives.init(this, m);
         assert(isResolved() && this.clazz != null);
@@ -505,6 +506,7 @@
     /** Create a name for the given reflected constructor.  The resulting name will be in a resolved state. */
     @SuppressWarnings("LeakingThisInConstructor")
     public MemberName(Constructor<?> ctor) {
+        ctor.getClass();  // NPE check
         // fill in vmtarget, vmindex while we have ctor in hand:
         MethodHandleNatives.init(this, ctor);
         assert(isResolved() && this.clazz != null);
@@ -519,6 +521,7 @@
     }
     @SuppressWarnings("LeakingThisInConstructor")
     public MemberName(Field fld, boolean makeSetter) {
+        fld.getClass();  // NPE check
         // fill in vmtarget, vmindex while we have fld in hand:
         MethodHandleNatives.init(this, fld);
         assert(isResolved() && this.clazz != null);