JDK 8 code review request for JDK-8014249 Add Modifer.parameterModifiers()

Mandy Chung mandy.chung at oracle.com
Wed May 8 22:26:17 UTC 2013


The change looks good to me.  I also think it's a good idea to swap out 
the comment for @jls tag for consistency.

Mandy

On 5/8/2013 2:13 PM, Joe Darcy wrote:
> Hi Mike,
>
> The public methods use the @jls tags while the private fields use the 
> comments. (What probably happened was that the old "JLSv3" comments 
> were missed in the comments -> tags pass.)
>
> I could swap out the comments for tags if you think that would be useful.
>
> Thanks,
>
> -Joe
>
> On 05/08/2013 01:46 PM, Mike Duigou wrote:
>> The substance of the change looks good to me.
>>
>> Why are "JLS section 8.1.1" comments used in some places and @jls 
>> tags (which I prefer since they are links) in other places?
>>
>> Mike
>>
>> On May 8 2013, at 13:20 , Joe Darcy wrote:
>>
>>> Hello,
>>>
>>> Please review my changes to address
>>>
>>>     JDK-8014249 Add Modifer.parameterModifiers()
>>>
>>> Diff below.
>>>
>>> The motivation is that since we now have a reflective model of 
>>> parameters (JDK-8004729), the java.lang.reflect.Modifier class 
>>> should provide a parameterModifiers method similar to other 
>>> "fooModifers" methods already in the class (JDK-6261502).
>>>
>>> Thanks,
>>>
>>> -Joe
>>>
>>> diff -r 2fba6ae13ed8 src/share/classes/java/lang/reflect/Modifier.java
>>> --- a/src/share/classes/java/lang/reflect/Modifier.java    Tue Apr 
>>> 30 12:32:49 2013 -0700
>>> +++ b/src/share/classes/java/lang/reflect/Modifier.java    Wed May 
>>> 08 13:16:22 2013 -0700
>>> @@ -351,7 +351,7 @@
>>>      }
>>>
>>>      /**
>>> -     * See JLSv3 section 8.1.1.
>>> +     * See JLS section 8.1.1.
>>>       */
>>>      private static final int CLASS_MODIFIERS =
>>>          Modifier.PUBLIC         | Modifier.PROTECTED    | 
>>> Modifier.PRIVATE |
>>> @@ -359,7 +359,7 @@
>>>          Modifier.STRICT;
>>>
>>>      /**
>>> -     * See JLSv3 section 9.1.1.
>>> +     * See JLS section 9.1.1.
>>>       */
>>>      private static final int INTERFACE_MODIFIERS =
>>>          Modifier.PUBLIC         | Modifier.PROTECTED    | 
>>> Modifier.PRIVATE |
>>> @@ -367,13 +367,13 @@
>>>
>>>
>>>      /**
>>> -     * See JLSv3 section 8.8.3.
>>> +     * See JLS section 8.8.3.
>>>       */
>>>      private static final int CONSTRUCTOR_MODIFIERS =
>>>          Modifier.PUBLIC         | Modifier.PROTECTED    | 
>>> Modifier.PRIVATE;
>>>
>>>      /**
>>> -     * See JLSv3 section 8.4.3.
>>> +     * See JLS section 8.4.3.
>>>       */
>>>      private static final int METHOD_MODIFIERS =
>>>          Modifier.PUBLIC         | Modifier.PROTECTED    | 
>>> Modifier.PRIVATE |
>>> @@ -381,7 +381,7 @@
>>>          Modifier.SYNCHRONIZED   | Modifier.NATIVE       | 
>>> Modifier.STRICT;
>>>
>>>      /**
>>> -     * See JLSv3 section 8.3.1.
>>> +     * See JLS section 8.3.1.
>>>       */
>>>      private static final int FIELD_MODIFIERS =
>>>          Modifier.PUBLIC         | Modifier.PROTECTED    | 
>>> Modifier.PRIVATE |
>>> @@ -389,6 +389,12 @@
>>>          Modifier.VOLATILE;
>>>
>>>      /**
>>> +     * See JLS section 8.4.1.
>>> +     */
>>> +    private static final int PARAMETER_MODIFIERS =
>>> +        Modifier.FINAL;
>>> +
>>> +    /**
>>>       *
>>>       */
>>>      static final int ACCESS_MODIFIERS =
>>> @@ -446,6 +452,18 @@
>>>          return METHOD_MODIFIERS;
>>>      }
>>>
>>> +    /**
>>> +     * Return an {@code int} value OR-ing together the source language
>>> +     * modifiers that can be applied to a parameter.
>>> +     * @return an {@code int} value OR-ing together the source 
>>> language
>>> +     * modifiers that can be applied to a parameter.
>>> +     *
>>> +     * @jls 8.4.1 Formal Parameters
>>> +     * @since 1.8
>>> +     */
>>> +    public static int parameterModifiers() {
>>> +        return PARAMETER_MODIFIERS;
>>> +    }
>>>
>>>      /**
>>>       * Return an {@code int} value OR-ing together the source language
>>>
>




More information about the core-libs-dev mailing list