< prev index next >

test/jdk/lib/testlibrary/bytecode/jdk/experimental/bytecode/Flag.java

Print this page

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_STRICT(0x0800);
47 
48     public int flag;
49 
50     Flag(int flag) {
51         this.flag = flag;
52     }
53 
54     static Flag[] parse(int flagsMask) {
55         EnumSet<Flag> flags = EnumSet.noneOf(Flag.class);
56         for (Flag f : Flag.values()) {
57             if ((f.flag & flagsMask) != 0) {
58                 flags.add(f);
59             }
60         }
61         return flags.stream().toArray(Flag[]::new);
62     }
63 }

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 }
< prev index next >