< prev index next >

src/java.base/share/classes/java/lang/invoke/MethodHandle.java

Print this page
rev 59151 : imported patch viewAs

@@ -1638,16 +1638,13 @@
     }
 
     /*non-public*/
     MethodHandle viewAsType(MethodType newType, boolean strict) {
         // No actual conversions, just a new view of the same method.
-        // Note that this operation must not produce a DirectMethodHandle,
-        // because retyped DMHs, like any transformed MHs,
-        // cannot be cracked into MethodHandleInfo.
+        // Overridden in DMH, which has special rules
         assert viewAsTypeChecks(newType, strict);
-        BoundMethodHandle mh = rebind();
-        return mh.copyWith(newType, mh.form);
+        return copyWith(newType, form);
     }
 
     /*non-public*/
     boolean viewAsTypeChecks(MethodType newType, boolean strict) {
         if (strict) {

@@ -1702,10 +1699,15 @@
     boolean isInvokeSpecial() {
         return false;  // DMH.Special returns true
     }
 
     /*non-public*/
+    boolean isCrackable() {
+        return false;
+    }
+
+    /*non-public*/
     Object internalValues() {
         return null;
     }
 
     /*non-public*/
< prev index next >