1 /*
2 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.vm.ci.hotspot;
24
25 import static java.lang.reflect.Modifier.ABSTRACT;
26 import static java.lang.reflect.Modifier.FINAL;
27 import static java.lang.reflect.Modifier.INTERFACE;
28 import static java.lang.reflect.Modifier.NATIVE;
29 import static java.lang.reflect.Modifier.PRIVATE;
30 import static java.lang.reflect.Modifier.PROTECTED;
31 import static java.lang.reflect.Modifier.PUBLIC;
32 import static java.lang.reflect.Modifier.STATIC;
33 import static java.lang.reflect.Modifier.STRICT;
34 import static java.lang.reflect.Modifier.SYNCHRONIZED;
35 import static java.lang.reflect.Modifier.TRANSIENT;
36 import static java.lang.reflect.Modifier.VOLATILE;
37 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
38
39 import java.lang.reflect.Modifier;
40
41 /**
42 * The non-public modifiers in {@link Modifier} that need to be retrieved from
43 * {@link HotSpotVMConfig}.
44 */
45 public class HotSpotModifiers {
46
47 // @formatter:off
48 public static final int ANNOTATION = config().jvmAccAnnotation;
49 public static final int ENUM = config().jvmAccEnum;
50 public static final int VARARGS = config().jvmAccVarargs;
51 public static final int BRIDGE = config().jvmAccBridge;
52 public static final int SYNTHETIC = config().jvmAccSynthetic;
53 // @formatter:on
54
55 public static int jvmClassModifiers() {
56 return PUBLIC | FINAL | INTERFACE | ABSTRACT | ANNOTATION | ENUM | SYNTHETIC;
57 }
58
59 public static int jvmMethodModifiers() {
60 return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | SYNCHRONIZED | BRIDGE | VARARGS | NATIVE | ABSTRACT | STRICT | SYNTHETIC;
61 }
62
63 public static int jvmFieldModifiers() {
64 return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | VOLATILE | TRANSIENT | ENUM | SYNTHETIC;
65 }
66 }
|
1 /*
2 * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.vm.ci.hotspot;
24
25 import jdk.internal.misc.PreviewFeatures;
26
27 import static java.lang.reflect.Modifier.ABSTRACT;
28 import static java.lang.reflect.Modifier.FINAL;
29 import static java.lang.reflect.Modifier.INTERFACE;
30 import static java.lang.reflect.Modifier.NATIVE;
31 import static java.lang.reflect.Modifier.PRIVATE;
32 import static java.lang.reflect.Modifier.PROTECTED;
33 import static java.lang.reflect.Modifier.PUBLIC;
34 import static java.lang.reflect.Modifier.STATIC;
35 import static java.lang.reflect.Modifier.STRICT;
36 import static java.lang.reflect.Modifier.SYNCHRONIZED;
37 import static java.lang.reflect.Modifier.TRANSIENT;
38 import static java.lang.reflect.Modifier.VOLATILE;
39 import static jdk.vm.ci.hotspot.HotSpotVMConfig.config;
40
41 import java.lang.reflect.Modifier;
42
43 /**
44 * The non-public modifiers in {@link Modifier} that need to be retrieved from
45 * {@link HotSpotVMConfig}.
46 */
47 public class HotSpotModifiers {
48
49 // @formatter:off
50 public static final int ANNOTATION = config().jvmAccAnnotation;
51 public static final int ENUM = config().jvmAccEnum;
52 public static final int VARARGS = config().jvmAccVarargs;
53 public static final int BRIDGE = config().jvmAccBridge;
54 public static final int SYNTHETIC = config().jvmAccSynthetic;
55 // @formatter:on
56
57 public static int jvmClassModifiers() {
58 return PUBLIC | FINAL | INTERFACE | ABSTRACT | ANNOTATION | ENUM | SYNTHETIC |
59 (PreviewFeatures.isEnabled() ? 0x0020 : 0); // ACC_IDENTITY temp constant to avoid preview dependency
60 }
61
62 public static int jvmMethodModifiers() {
63 return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | SYNCHRONIZED | BRIDGE | VARARGS | NATIVE | ABSTRACT | STRICT | SYNTHETIC;
64 }
65
66 public static int jvmFieldModifiers() {
67 return PUBLIC | PRIVATE | PROTECTED | STATIC | FINAL | VOLATILE | TRANSIENT | ENUM | SYNTHETIC;
68 }
69 }
|