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