src/java.base/share/classes/java/lang/reflect/Modifier.java
author chegar
Thu, 17 Oct 2019 20:54:25 +0100
branchdatagramsocketimpl-branch
changeset 58679 9c3209ff7550
parent 58678 9cf78a70fa4f
parent 58054 ee230ad8cfef
permissions -rw-r--r--
datagramsocketimpl-branch: merge with default
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
54952
a978d86ac389 8224175: Fix inconsistencies in @jls and @jvms tags
darcy
parents: 47216
diff changeset
     2
 * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3712
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3712
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3712
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3712
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 3712
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.lang.reflect;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
25815
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
    28
import java.util.StringJoiner;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * The Modifier class provides {@code static} methods and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * constants to decode class and member access modifiers.  The sets of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * modifiers are represented as integers with distinct bit positions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * representing different modifiers.  The values for the constants
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
    35
 * representing the modifiers are taken from the tables in sections 4.1, 4.4, 4.5, and 4.7 of
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
    36
 * <cite>The Java&trade; Virtual Machine Specification</cite>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * @see Class#getModifiers()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * @see Member#getModifiers()
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * @author Nakul Saraiya
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * @author Kenneth Russell
45434
4582657c7260 8181082: class-level since tag issues in java.base & java.datatransfer module
mli
parents: 37363
diff changeset
    43
 * @since 1.1
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 */
16743
b0b34102bb4c 6298888: Add toGenericString to j.l.Class and getTypeName to j.l.reflect.Type
darcy
parents: 16729
diff changeset
    45
public class Modifier {
58054
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    46
    /**
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    47
     * Do not call.
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    48
     */
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    49
    @Deprecated(forRemoval=true, since="14")
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    50
    public Modifier() {}
ee230ad8cfef 8230723: Remove default constructors from java.lang and java.io
darcy
parents: 57503
diff changeset
    51
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     * {@code public} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     * {@code public} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    public static boolean isPublic(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
        return (mod & PUBLIC) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     * {@code private} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * {@code private} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
    public static boolean isPrivate(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
        return (mod & PRIVATE) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * {@code protected} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * {@code protected} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public static boolean isProtected(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        return (mod & PROTECTED) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * {@code static} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * {@code static} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    public static boolean isStatic(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
        return (mod & STATIC) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     * {@code final} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * {@code final} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    public static boolean isFinal(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
        return (mod & FINAL) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * {@code synchronized} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     * {@code synchronized} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    public static boolean isSynchronized(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
        return (mod & SYNCHRONIZED) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
     * {@code volatile} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * {@code volatile} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    public static boolean isVolatile(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
        return (mod & VOLATILE) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     * {@code transient} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * {@code transient} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    public static boolean isTransient(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
        return (mod & TRANSIENT) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * {@code native} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * {@code native} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    public static boolean isNative(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
        return (mod & NATIVE) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
     * {@code interface} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
     * {@code interface} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    public static boolean isInterface(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        return (mod & INTERFACE) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * {@code abstract} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * {@code abstract} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    public static boolean isAbstract(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
        return (mod & ABSTRACT) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * Return {@code true} if the integer argument includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * {@code strictfp} modifier, {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
     * @return {@code true} if {@code mod} includes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
     * {@code strictfp} modifier; {@code false} otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    public static boolean isStrict(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        return (mod & STRICT) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * Return a string describing the access modifier flags in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     * the specified modifier. For example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
     * <blockquote><pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
     *    public final synchronized strictfp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
     * </pre></blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * The modifier names are returned in an order consistent with the
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   204
     * suggested modifier orderings given in sections 8.1.1, 8.3.1, 8.4.3, 8.8.3, and 9.1.1 of
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   205
     * <cite>The Java&trade; Language Specification</cite>.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * The full modifier ordering used by this method is:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * <blockquote> {@code
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     * public protected private abstract static final transient
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
     * volatile synchronized native strictfp
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
     * interface } </blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
     * The {@code interface} modifier discussed in this class is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * not a true modifier in the Java language and it appears after
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * all other modifiers listed by this method.  This method may
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * return a string of modifiers that are not valid modifiers of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * Java entity; in other words, no checking is done on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * possible validity of the combination of modifiers represented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * by the input.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     *
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   219
     * Note that to perform such checking for a known kind of entity,
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   220
     * such as a constructor or method, first AND the argument of
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   221
     * {@code toString} with the appropriate mask from a method like
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   222
     * {@link #constructorModifiers} or {@link #methodModifiers}.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   223
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @param   mod a set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     * @return  a string representation of the set of modifiers
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
     * represented by {@code mod}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    public static String toString(int mod) {
25815
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   229
        StringJoiner sj = new StringJoiner(" ");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
25815
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   231
        if ((mod & PUBLIC) != 0)        sj.add("public");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   232
        if ((mod & PROTECTED) != 0)     sj.add("protected");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   233
        if ((mod & PRIVATE) != 0)       sj.add("private");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        /* Canonical order */
25815
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   236
        if ((mod & ABSTRACT) != 0)      sj.add("abstract");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   237
        if ((mod & STATIC) != 0)        sj.add("static");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   238
        if ((mod & FINAL) != 0)         sj.add("final");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   239
        if ((mod & TRANSIENT) != 0)     sj.add("transient");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   240
        if ((mod & VOLATILE) != 0)      sj.add("volatile");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   241
        if ((mod & SYNCHRONIZED) != 0)  sj.add("synchronized");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   242
        if ((mod & NATIVE) != 0)        sj.add("native");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   243
        if ((mod & STRICT) != 0)        sj.add("strictfp");
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   244
        if ((mod & INTERFACE) != 0)     sj.add("interface");
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
25815
647f633280c3 8051382: Optimize java.lang.reflect.Modifier.toString()
igerasim
parents: 17452
diff changeset
   246
        return sj.toString();
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /*
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   250
     * Access modifier flag constants from tables 4.1, 4.4, 4.5, and 4.7 of
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   251
     * <cite>The Java&trade; Virtual Machine Specification</cite>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     * The {@code int} value representing the {@code public}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    public static final int PUBLIC           = 0x00000001;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * The {@code int} value representing the {@code private}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    public static final int PRIVATE          = 0x00000002;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     * The {@code int} value representing the {@code protected}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    public static final int PROTECTED        = 0x00000004;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * The {@code int} value representing the {@code static}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    public static final int STATIC           = 0x00000008;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * The {@code int} value representing the {@code final}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    public static final int FINAL            = 0x00000010;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * The {@code int} value representing the {@code synchronized}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public static final int SYNCHRONIZED     = 0x00000020;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * The {@code int} value representing the {@code volatile}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
    public static final int VOLATILE         = 0x00000040;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * The {@code int} value representing the {@code transient}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
    public static final int TRANSIENT        = 0x00000080;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * The {@code int} value representing the {@code native}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    public static final int NATIVE           = 0x00000100;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
     * The {@code int} value representing the {@code interface}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
    public static final int INTERFACE        = 0x00000200;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * The {@code int} value representing the {@code abstract}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    public static final int ABSTRACT         = 0x00000400;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * The {@code int} value representing the {@code strictfp}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * modifier.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    public static final int STRICT           = 0x00000800;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    // Bits not (yet) exposed in the public API either because they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    // have different meanings for fields and methods and there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    // way to distinguish between the two in this class, or because
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    // they are not Java programming language keywords
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    static final int BRIDGE    = 0x00000040;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    static final int VARARGS   = 0x00000080;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    static final int SYNTHETIC = 0x00001000;
15294
df55735ea03c 8004729: Add java.lang.reflect.Parameter and related changes for parameter reflection
robm
parents: 14342
diff changeset
   333
    static final int ANNOTATION  = 0x00002000;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    static final int ENUM      = 0x00004000;
15655
d9ab4d9ee4f2 8007405: Update java.lang.reflect API to replace SYNTHESIZED with MANDATED
alanb
parents: 15294
diff changeset
   335
    static final int MANDATED  = 0x00008000;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    static boolean isSynthetic(int mod) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
      return (mod & SYNTHETIC) != 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    }
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   339
15655
d9ab4d9ee4f2 8007405: Update java.lang.reflect API to replace SYNTHESIZED with MANDATED
alanb
parents: 15294
diff changeset
   340
    static boolean isMandated(int mod) {
d9ab4d9ee4f2 8007405: Update java.lang.reflect API to replace SYNTHESIZED with MANDATED
alanb
parents: 15294
diff changeset
   341
      return (mod & MANDATED) != 0;
15294
df55735ea03c 8004729: Add java.lang.reflect.Parameter and related changes for parameter reflection
robm
parents: 14342
diff changeset
   342
    }
df55735ea03c 8004729: Add java.lang.reflect.Parameter and related changes for parameter reflection
robm
parents: 14342
diff changeset
   343
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   344
    // Note on the FOO_MODIFIERS fields and fooModifiers() methods:
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   345
    // the sets of modifiers are not guaranteed to be constants
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   346
    // across time and Java SE releases. Therefore, it would not be
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   347
    // appropriate to expose an external interface to this information
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   348
    // that would allow the values to be treated as Java-level
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   349
    // constants since the values could be constant folded and updates
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   350
    // to the sets of modifiers missed. Thus, the fooModifiers()
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   351
    // methods return an unchanging values for a given release, but a
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   352
    // value that can potentially change over time.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   353
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   354
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   355
     * The Java source modifiers that can be applied to a class.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   356
     * @jls 8.1.1 Class Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   357
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   358
    private static final int CLASS_MODIFIERS =
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   359
        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   360
        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.FINAL   |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   361
        Modifier.STRICT;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   362
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   363
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   364
     * The Java source modifiers that can be applied to an interface.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   365
     * @jls 9.1.1 Interface Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   366
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   367
    private static final int INTERFACE_MODIFIERS =
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   368
        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   369
        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.STRICT;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   370
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   371
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   372
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   373
     * The Java source modifiers that can be applied to a constructor.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   374
     * @jls 8.8.3 Constructor Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   375
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   376
    private static final int CONSTRUCTOR_MODIFIERS =
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   377
        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   378
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   379
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   380
     * The Java source modifiers that can be applied to a method.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   381
     * @jls8.4.3  Method Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   382
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   383
    private static final int METHOD_MODIFIERS =
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   384
        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   385
        Modifier.ABSTRACT       | Modifier.STATIC       | Modifier.FINAL   |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   386
        Modifier.SYNCHRONIZED   | Modifier.NATIVE       | Modifier.STRICT;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   387
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   388
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   389
     * The Java source modifiers that can be applied to a field.
54952
a978d86ac389 8224175: Fix inconsistencies in @jls and @jvms tags
darcy
parents: 47216
diff changeset
   390
     * @jls 8.3.1 Field Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   391
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   392
    private static final int FIELD_MODIFIERS =
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   393
        Modifier.PUBLIC         | Modifier.PROTECTED    | Modifier.PRIVATE |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   394
        Modifier.STATIC         | Modifier.FINAL        | Modifier.TRANSIENT |
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   395
        Modifier.VOLATILE;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   396
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   397
    /**
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   398
     * The Java source modifiers that can be applied to a method or constructor parameter.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   399
     * @jls 8.4.1 Formal Parameters
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   400
     */
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   401
    private static final int PARAMETER_MODIFIERS =
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   402
        Modifier.FINAL;
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   403
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   404
    /**
16729
3b26e313ad81 8004979: java.lang.reflect.Modifier.toString should include "default"
darcy
parents: 15655
diff changeset
   405
     *
3b26e313ad81 8004979: java.lang.reflect.Modifier.toString should include "default"
darcy
parents: 15655
diff changeset
   406
     */
3b26e313ad81 8004979: java.lang.reflect.Modifier.toString should include "default"
darcy
parents: 15655
diff changeset
   407
    static final int ACCESS_MODIFIERS =
16743
b0b34102bb4c 6298888: Add toGenericString to j.l.Class and getTypeName to j.l.reflect.Type
darcy
parents: 16729
diff changeset
   408
        Modifier.PUBLIC | Modifier.PROTECTED | Modifier.PRIVATE;
16729
3b26e313ad81 8004979: java.lang.reflect.Modifier.toString should include "default"
darcy
parents: 15655
diff changeset
   409
3b26e313ad81 8004979: java.lang.reflect.Modifier.toString should include "default"
darcy
parents: 15655
diff changeset
   410
    /**
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   411
     * Return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   412
     * modifiers that can be applied to a class.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   413
     * @return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   414
     * modifiers that can be applied to a class.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   415
     *
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   416
     * @jls 8.1.1 Class Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   417
     * @since 1.7
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   418
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   419
    public static int classModifiers() {
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   420
        return CLASS_MODIFIERS;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   421
    }
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   422
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   423
    /**
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   424
     * Return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   425
     * modifiers that can be applied to an interface.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   426
     * @return an {@code int} value OR-ing together the source language
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   427
     * modifiers that can be applied to an interface.
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   428
     *
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   429
     * @jls 9.1.1 Interface Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   430
     * @since 1.7
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   431
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   432
    public static int interfaceModifiers() {
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   433
        return INTERFACE_MODIFIERS;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   434
    }
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   435
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   436
    /**
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   437
     * Return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   438
     * modifiers that can be applied to a constructor.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   439
     * @return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   440
     * modifiers that can be applied to a constructor.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   441
     *
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   442
     * @jls 8.8.3 Constructor Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   443
     * @since 1.7
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   444
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   445
    public static int constructorModifiers() {
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   446
        return CONSTRUCTOR_MODIFIERS;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   447
    }
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   448
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   449
    /**
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   450
     * Return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   451
     * modifiers that can be applied to a method.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   452
     * @return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   453
     * modifiers that can be applied to a method.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   454
     *
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   455
     * @jls 8.4.3 Method Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   456
     * @since 1.7
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   457
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   458
    public static int methodModifiers() {
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   459
        return METHOD_MODIFIERS;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   460
    }
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   461
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   462
    /**
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   463
     * Return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   464
     * modifiers that can be applied to a field.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   465
     * @return an {@code int} value OR-ing together the source language
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   466
     * modifiers that can be applied to a field.
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   467
     *
9266
121fb370f179 7032960: API files in java.awt need to be updated for references to JVM Spec with editions/hyperlinks
jjh
parents: 5506
diff changeset
   468
     * @jls 8.3.1 Field Modifiers
3712
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   469
     * @since 1.7
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   470
     */
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   471
    public static int fieldModifiers() {
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   472
        return FIELD_MODIFIERS;
8851d55adef0 6261502: (reflect) Add the functionality to screen out the "inappropriate" modifier bits
darcy
parents: 715
diff changeset
   473
    }
17452
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   474
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   475
    /**
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   476
     * Return an {@code int} value OR-ing together the source language
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   477
     * modifiers that can be applied to a parameter.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   478
     * @return an {@code int} value OR-ing together the source language
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   479
     * modifiers that can be applied to a parameter.
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   480
     *
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   481
     * @jls 8.4.1 Formal Parameters
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   482
     * @since 1.8
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   483
     */
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   484
    public static int parameterModifiers() {
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   485
        return PARAMETER_MODIFIERS;
1e94dbb5f8d7 8014249: Add Modifer.parameterModifiers()
darcy
parents: 16743
diff changeset
   486
    }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
}