Thank You Paul for the suggestions.

Please review the updated webrev


On 4/12/2016 7:32 PM, Paul Sandoz wrote:

Just minor comments, below.



  972     /**
  973       * Adapts this method handle to be {@linkplain #asVarargsCollector 
variable arity}
  974       * if the boolean flag is true, else {@linkplain #asFixedArity fixed 
  975       * If the method handle is already of the proper arity mode, it is 
  976       * unchanged.
  977       * <p>This method is sometimes useful when adapting a method handle 
  978       * may be variable arity, to ensure that the resulting adapter is 
  979       * variable arity if and only if the original handle was.  For 
  980       * this code changes the first argument of a handle

, {@code mh},

to {@code int} without
  981       * disturbing its variable arity property:
  982       * {@code 

The above paragraph can be an @apiNote.

Also can you format the code block over two lines to emphasise the last call., 
otherwise i think it is harder to read.

  983       * @param makeVarargs true if the return method handle should have 
variable arity behavior
  984       * @return a method handle of the same type, with possibly adjusted 
variable arity behavior
  985       * @throws IllegalArgumentException if {@code makeVarargs} is true 
  986       *         this method handle does not have a trailing array 
  987       * @since 9


@see #asVarargsCollector
@see #asFixedArity


  988      */
  989      public MethodHandle withVarargs(boolean makeVarargs) {


2387     /** Produces a constant method handle of the requested return type 

new line after ‘/**'

2388      * returns the default value for that type every time it is invoked.
2389      * The resulting constant method handle will have no side effects.
2390      * <p>The returned method handle is equivalent to {@code 
2391      * It is also equivalent to {@code 
explicitCastArguments(constant(Object.class, null), methodType(type))},
2392      * since {@code explicitCastArguments} converts {@code null} to 
default values.

Is this method more efficient than the other two?
It is existing method made it public and renamed it to zero from zeroHandle.

2393      * @param type the expected return type of the desired method handle
2394      * @return a constant method handle that takes no arguments and 
returns the default value of the given type (or void, if the type is void)

Can you format to be a little more consistent and not so long on the line 
length, as it becomes really tricky read.

2395      * @throws NullPointerException if the argument is null
2396      * @see MethodHandles#constant
2397      * @see MethodHandles#empty
2398      * @since 9
2399      */
2400     public static  MethodHandle zero(Class<?> type) {
2401         Objects.requireNonNull(type);
2402         return type.isPrimitive() ?  zero(Wrapper.forPrimitiveType(type), 
type) : zero(Wrapper.OBJECT, type);
2403     }

2409     /**
2410      * Produces a method handle of the requested type which ignores any 
arguments, does nothing,
2411      * and returns a suitable default depending on the return type.
2412      * That is, it returns a zero primitive value, a {@code null}, or 
{@code void}.
2413      * <p>The returned method handle is equivalent to
2414      * {@code dropArguments(zero(type.returnType()), 0, 
2415      * <p>
2416      * Example:  Given a predicate and target, a useful "if-then" 
construct can be constructed as

s/Example:/@apiNote (same applies to the method dropArgumentsToMatch)


2417      * {@code guardWithTest(pred, target, empty(target.type())}.
2418      * @param type the type of the desired method handle
2419      * @return a constant method handle of the given type, which returns a 
default value of the given return type
2420      * @throws NullPointerException if the argument is null
2421      * @see MethodHandles#zero
2422      * @see MethodHandles#constant
2423      * @since 9
2424      */
2425     public static  MethodHandle empty(MethodType type) {

2726 MethodHandle h0= constant(boolean.class, true);

Space before '='


You should test the signatures and values for all primitives, ref and void.

On 11 Apr 2016, at 07:47, wrote:

Gentle Reminder!

-------- Forwarded Message --------
Subject:        RFR [9] 8150829: Enhanced drop-args, identity and default 
constant, varargs adjustment
Date:   Thu, 24 Mar 2016 11:18:56 +0530
From: <>

Hi All,

Please review the following-


mlvm-dev mailing list

mlvm-dev mailing list

mlvm-dev mailing list

Reply via email to