1 /*
2 * Copyright (c) 2017, 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
24 package jdk.experimental.bytecode;
25
26 import java.util.EnumSet;
27
28 public enum Flag {
29 ACC_PUBLIC(0x0001),
30 ACC_PROTECTED(0x0004),
31 ACC_PRIVATE(0x0002),
32 ACC_INTERFACE(0x0200),
33 ACC_ENUM(0x4000),
34 ACC_ANNOTATION(0x2000),
35 ACC_SUPER(0x0020),
36 ACC_ABSTRACT(0x0400),
37 ACC_VOLATILE(0x0040),
38 ACC_TRANSIENT(0x0080),
39 ACC_SYNTHETIC(0x1000),
40 ACC_STATIC(0x0008),
41 ACC_FINAL(0x0010),
42 ACC_SYNCHRONIZED(0x0020),
43 ACC_BRIDGE(0x0040),
44 ACC_VARARGS(0x0080),
45 ACC_NATIVE(0x0100),
46 ACC_INLINE(0x0100),
47 ACC_STRICT(0x0800);
48
49 public int flag;
50
51 Flag(int flag) {
52 this.flag = flag;
53 }
54
55 static Flag[] parse(int flagsMask) {
56 EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);
57 for (Flag f : Flag.values()) {
58 if ((f.flag & flagsMask) != 0) {
59 flags.add(f);
60 }
61 }
62 return flags.stream().toArray(Flag[]::new);
63 }
64 }
--- EOF ---