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

Joe Darcy joe.darcy at oracle.com
Thu May 9 03:18:47 UTC 2013


Hi Remi,

In this context, the modifiers in question are only source-level modifiers.

Thanks,

-Joe

On 05/08/2013 03:52 PM, Remi Forax wrote:
> Hi Joe,
> does the spec has changed recently, or you should also add SYNTHETIZED 
> to parameter modifiers ?
>
> Rémi
>
> On 05/08/2013 10:20 PM, 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