< prev index next >

src/java.base/share/classes/java/lang/reflect/Modifier.java

Print this page
@@ -1,7 +1,7 @@
  /*
-  * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
+  * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   *
   * This code is free software; you can redistribute it and/or modify it
   * under the terms of the GNU General Public License version 2 only, as
   * published by the Free Software Foundation.  Oracle designates this

@@ -120,10 +120,22 @@
       */
      public static boolean isSynchronized(int mod) {
          return (mod & SYNCHRONIZED) != 0;
      }
  
+     /**
+      * Return {@code true} if the integer argument includes the
+      * {@code permitsValue} modifier, {@code false} otherwise.
+      *
+      * @param   mod a set of modifiers
+      * @return {@code true} if {@code mod} includes the
+      * {@code permitsValue} modifier; {@code false} otherwise.
+      */
+     public static boolean isPermitsValue(int mod) {
+         return (mod & PERMITS_VALUE) != 0;
+     }
+ 
      /**
       * Return {@code true} if the integer argument includes the
       * {@code volatile} modifier, {@code false} otherwise.
       *
       * @param   mod a set of modifiers

@@ -285,10 +297,16 @@
       * The {@code int} value representing the {@code synchronized}
       * modifier.
       */
      public static final int SYNCHRONIZED     = 0x00000020;
  
+     /**
+      * The {@code int} value representing the {@code permits_value}
+      * modifier.
+      */
+     public static final int PERMITS_VALUE    = 0x00000040;
+ 
      /**
       * The {@code int} value representing the {@code volatile}
       * modifier.
       */
      public static final int VOLATILE         = 0x00000040;

@@ -325,16 +343,16 @@
  
      // Bits not (yet) exposed in the public API either because they
      // have different meanings for fields and methods and there is no
      // way to distinguish between the two in this class, or because
      // they are not Java programming language keywords
-     static final int BRIDGE    = 0x00000040;
-     static final int VARARGS   = 0x00000080;
-     static final int SYNTHETIC = 0x00001000;
+     static final int BRIDGE      = 0x00000040;
+     static final int VARARGS     = 0x00000080;
+     static final int SYNTHETIC   = 0x00001000;
      static final int ANNOTATION  = 0x00002000;
-     static final int ENUM      = 0x00004000;
-     static final int MANDATED  = 0x00008000;
+     static final int ENUM        = 0x00004000;
+     static final int MANDATED    = 0x00008000;
      static boolean isSynthetic(int mod) {
        return (mod & SYNTHETIC) != 0;
      }
  
      static boolean isMandated(int mod) {

@@ -356,11 +374,11 @@
       * @jls 8.1.1 Class Modifiers
       */
      private static final int CLASS_MODIFIERS =
          Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
          Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.FINAL   |
-         Modifier.STRICT;
+         Modifier.STRICT         | Modifier.PERMITS_VALUE;
  
      /**
       * The Java source modifiers that can be applied to an interface.
       * @jls 9.1.1 Interface Modifiers
       */
< prev index next >