56 public static final int ACC_SYNTHETIC = 0x1000; // class, inner, field, method |
56 public static final int ACC_SYNTHETIC = 0x1000; // class, inner, field, method |
57 public static final int ACC_ANNOTATION = 0x2000; // class, inner |
57 public static final int ACC_ANNOTATION = 0x2000; // class, inner |
58 public static final int ACC_ENUM = 0x4000; // class, inner, field |
58 public static final int ACC_ENUM = 0x4000; // class, inner, field |
59 public static final int ACC_MANDATED = 0x8000; // class, inner, field, method |
59 public static final int ACC_MANDATED = 0x8000; // class, inner, field, method |
60 |
60 |
61 public static enum Kind { Class, InnerClass, Field, Method}; |
61 public static enum Kind { Class, InnerClass, Field, Method} |
62 |
62 |
63 AccessFlags(ClassReader cr) throws IOException { |
63 AccessFlags(ClassReader cr) throws IOException { |
64 this(cr.readUnsignedShort()); |
64 this(cr.readUnsignedShort()); |
65 } |
65 } |
66 |
66 |
157 private Set<String> getModifiers(int[] modifierFlags, Kind t) { |
157 private Set<String> getModifiers(int[] modifierFlags, Kind t) { |
158 return getModifiers(flags, modifierFlags, t); |
158 return getModifiers(flags, modifierFlags, t); |
159 } |
159 } |
160 |
160 |
161 private static Set<String> getModifiers(int flags, int[] modifierFlags, Kind t) { |
161 private static Set<String> getModifiers(int flags, int[] modifierFlags, Kind t) { |
162 Set<String> s = new LinkedHashSet<String>(); |
162 Set<String> s = new LinkedHashSet<>(); |
163 for (int m: modifierFlags) { |
163 for (int m: modifierFlags) { |
164 if ((flags & m) != 0) |
164 if ((flags & m) != 0) |
165 s.add(flagToModifier(m, t)); |
165 s.add(flagToModifier(m, t)); |
166 } |
166 } |
167 return s; |
167 return s; |
168 } |
168 } |
169 |
169 |
170 private Set<String> getFlags(int[] expectedFlags, Kind t) { |
170 private Set<String> getFlags(int[] expectedFlags, Kind t) { |
171 Set<String> s = new LinkedHashSet<String>(); |
171 Set<String> s = new LinkedHashSet<>(); |
172 int f = flags; |
172 int f = flags; |
173 for (int e: expectedFlags) { |
173 for (int e: expectedFlags) { |
174 if ((f & e) != 0) { |
174 if ((f & e) != 0) { |
175 s.add(flagToName(e, t)); |
175 s.add(flagToName(e, t)); |
176 f = f & ~e; |
176 f = f & ~e; |