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 }