< prev index next >

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

Print this page
*** 1,7 ***
  /*
!  * Copyright (c) 1996, 2020, 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
--- 1,7 ---
  /*
!  * 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

*** 252,70 ***
--- 264,87 ---
       */
  
      /**
       * The {@code int} value representing the {@code public}
       * modifier.
+      * @see AccessFlag#PUBLIC
       */
      public static final int PUBLIC           = 0x00000001;
  
      /**
       * The {@code int} value representing the {@code private}
       * modifier.
+      * @see AccessFlag#PRIVATE
       */
      public static final int PRIVATE          = 0x00000002;
  
      /**
       * The {@code int} value representing the {@code protected}
       * modifier.
+      * @see AccessFlag#PROTECTED
       */
      public static final int PROTECTED        = 0x00000004;
  
      /**
       * The {@code int} value representing the {@code static}
       * modifier.
+      * @see AccessFlag#STATIC
       */
      public static final int STATIC           = 0x00000008;
  
      /**
       * The {@code int} value representing the {@code final}
       * modifier.
+      * @see AccessFlag#FINAL
       */
      public static final int FINAL            = 0x00000010;
  
      /**
       * The {@code int} value representing the {@code synchronized}
       * modifier.
+      * @see AccessFlag#SYNCHRONIZED
       */
      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.
+      * @see AccessFlag#VOLATILE
       */
      public static final int VOLATILE         = 0x00000040;
  
      /**
       * The {@code int} value representing the {@code transient}
       * modifier.
+      * @see AccessFlag#TRANSIENT
       */
      public static final int TRANSIENT        = 0x00000080;
  
      /**
       * The {@code int} value representing the {@code native}
       * modifier.
+      * @see AccessFlag#NATIVE
       */
      public static final int NATIVE           = 0x00000100;
  
      /**
       * The {@code int} value representing the {@code interface}
       * modifier.
+      * @see AccessFlag#INTERFACE
       */
      public static final int INTERFACE        = 0x00000200;
  
      /**
       * The {@code int} value representing the {@code abstract}
       * modifier.
+      * @see AccessFlag#ABSTRACT
       */
      public static final int ABSTRACT         = 0x00000400;
  
      /**
       * The {@code int} value representing the {@code strictfp}

*** 325,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 ANNOTATION  = 0x00002000;
!     static final int ENUM      = 0x00004000;
!     static final int MANDATED  = 0x00008000;
      static boolean isSynthetic(int mod) {
        return (mod & SYNTHETIC) != 0;
      }
  
      static boolean isMandated(int mod) {
--- 354,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 ANNOTATION  = 0x00002000;
!     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 ***
       * @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;
  
      /**
       * The Java source modifiers that can be applied to an interface.
       * @jls 9.1.1 Interface Modifiers
       */
--- 385,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.PERMITS_VALUE;
  
      /**
       * The Java source modifiers that can be applied to an interface.
       * @jls 9.1.1 Interface Modifiers
       */
< prev index next >