src/share/classes/java/lang/invoke/MethodHandle.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Sdiff src/share/classes/java/lang/invoke

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

Print this page
rev 9490 : temp
* * *
Get rid of char-based descriptions 'J' of basic types; use short dense indexes LambdaForm.J_TYPE.


1357     Object internalValues() {
1358         return null;
1359     }
1360 
1361     /*non-public*/
1362     Object internalProperties() {
1363         // Override to something like "/FOO=bar"
1364         return "";
1365     }
1366 
1367     //// Method handle implementation methods.
1368     //// Sub-classes can override these default implementations.
1369     //// All these methods assume arguments are already validated.
1370 
1371     /*non-public*/ MethodHandle convertArguments(MethodType newType) {
1372         // Override this if it can be improved.
1373         return MethodHandleImpl.makePairwiseConvert(this, newType, 1);
1374     }
1375 
1376     /*non-public*/
1377     MethodHandle bindArgument(int pos, char basicType, Object value) {
1378         // Override this if it can be improved.
1379         return rebind().bindArgument(pos, basicType, value);
1380     }
1381 
1382     /*non-public*/
1383     MethodHandle bindReceiver(Object receiver) {
1384         // Override this if it can be improved.
1385         return bindArgument(0, 'L', receiver);
1386     }
1387 
1388     /*non-public*/
1389     MethodHandle bindImmediate(int pos, char basicType, Object value) {
1390         // Bind an immediate value to a position in the arguments.
1391         // This means, elide the respective argument,
1392         // and replace all references to it in NamedFunction args with the specified value.
1393 
1394         // CURRENT RESTRICTIONS
1395         // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others)
1396         assert pos == 0 && basicType == 'L' && value instanceof Unsafe;
1397         MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver!
1398         LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos
1399         return copyWith(type2, form2);
1400     }
1401 
1402     /*non-public*/
1403     MethodHandle copyWith(MethodType mt, LambdaForm lf) {
1404         throw new InternalError("copyWith: " + this.getClass());
1405     }
1406 
1407     /*non-public*/
1408     MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
1409         // Override this if it can be improved.
1410         return rebind().dropArguments(srcType, pos, drops);
1411     }
1412 
1413     /*non-public*/
1414     MethodHandle permuteArguments(MethodType newType, int[] reorder) {
1415         // Override this if it can be improved.
1416         return rebind().permuteArguments(newType, reorder);




1357     Object internalValues() {
1358         return null;
1359     }
1360 
1361     /*non-public*/
1362     Object internalProperties() {
1363         // Override to something like "/FOO=bar"
1364         return "";
1365     }
1366 
1367     //// Method handle implementation methods.
1368     //// Sub-classes can override these default implementations.
1369     //// All these methods assume arguments are already validated.
1370 
1371     /*non-public*/ MethodHandle convertArguments(MethodType newType) {
1372         // Override this if it can be improved.
1373         return MethodHandleImpl.makePairwiseConvert(this, newType, 1);
1374     }
1375 
1376     /*non-public*/
1377     MethodHandle bindArgument(int pos, byte basicType, Object value) {
1378         // Override this if it can be improved.
1379         return rebind().bindArgument(pos, basicType, value);
1380     }
1381 
1382     /*non-public*/
1383     MethodHandle bindReceiver(Object receiver) {
1384         // Override this if it can be improved.
1385         return bindArgument(0, LambdaForm.L_TYPE, receiver);
1386     }
1387 
1388     /*non-public*/
1389     MethodHandle bindImmediate(int pos, byte basicType, Object value) {
1390         // Bind an immediate value to a position in the arguments.
1391         // This means, elide the respective argument,
1392         // and replace all references to it in NamedFunction args with the specified value.
1393 
1394         // CURRENT RESTRICTIONS
1395         // * only for pos 0 and UNSAFE (position is adjusted in MHImpl to make API usable for others)
1396         assert pos == 0 && basicType == LambdaForm.L_TYPE && value instanceof Unsafe;
1397         MethodType type2 = type.dropParameterTypes(pos, pos + 1); // adjustment: ignore receiver!
1398         LambdaForm form2 = form.bindImmediate(pos + 1, basicType, value); // adjust pos to form-relative pos
1399         return copyWith(type2, form2);
1400     }
1401 
1402     /*non-public*/
1403     MethodHandle copyWith(MethodType mt, LambdaForm lf) {
1404         throw new InternalError("copyWith: " + this.getClass());
1405     }
1406 
1407     /*non-public*/
1408     MethodHandle dropArguments(MethodType srcType, int pos, int drops) {
1409         // Override this if it can be improved.
1410         return rebind().dropArguments(srcType, pos, drops);
1411     }
1412 
1413     /*non-public*/
1414     MethodHandle permuteArguments(MethodType newType, int[] reorder) {
1415         // Override this if it can be improved.
1416         return rebind().permuteArguments(newType, reorder);


src/share/classes/java/lang/invoke/MethodHandle.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File