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

Remi Forax forax at univ-mlv.fr
Wed May 8 22:52:11 UTC 2013


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 CLASSMODIFIERS = 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 INTERFACEMODIFIERS = 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 CONSTRUCTORMODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE; /** - * See JLSv3 section 8.4.3. + * See JLS section 8.4.3. */ private static final int METHODMODIFIERS = 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 FIELDMODIFIERS = Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE | @@ -389,6 +389,12 @@ Modifier.VOLATILE; /** + * See JLS section 8.4.1. + */ + private static final int PARAMETERMODIFIERS = + Modifier.FINAL; + + /** * */ static final int ACCESSMODIFIERS = @@ -446,6 +452,18 @@ return METHODMODIFIERS; } + /** + * 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 PARAMETERMODIFIERS; + } /** * Return an {@code int} value OR-ing together the source language



More information about the core-libs-dev mailing list