classfile_parser/
types.rs

1use attribute_info::AttributeInfo;
2use constant_info::ConstantInfo;
3use field_info::FieldInfo;
4use method_info::MethodInfo;
5
6#[derive(Clone, Debug)]
7pub struct ClassFile {
8    pub minor_version: u16,
9    pub major_version: u16,
10    pub const_pool_size: u16,
11    pub const_pool: Vec<ConstantInfo>,
12    pub access_flags: ClassAccessFlags,
13    pub this_class: u16,
14    pub super_class: u16,
15    pub interfaces_count: u16,
16    pub interfaces: Vec<u16>,
17    pub fields_count: u16,
18    pub fields: Vec<FieldInfo>,
19    pub methods_count: u16,
20    pub methods: Vec<MethodInfo>,
21    pub attributes_count: u16,
22    pub attributes: Vec<AttributeInfo>,
23}
24
25bitflags! {
26    #[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
27    pub struct ClassAccessFlags: u16 {
28        const PUBLIC = 0x0001;     //	Declared public; may be accessed from outside its package.
29        const FINAL = 0x0010;      //	Declared final; no subclasses allowed.
30        const SUPER = 0x0020;      //	Treat superclass methods specially when invoked by the invokespecial instruction.
31        const INTERFACE = 0x0200;  //	Is an interface, not a class.
32        const ABSTRACT = 0x0400;   //	Declared abstract; must not be instantiated.
33        const SYNTHETIC = 0x1000;  //	Declared synthetic; not present in the source code.
34        const ANNOTATION = 0x2000; //	Declared as an annotation type.
35        const ENUM = 0x4000;       //	Declared as an enum type.
36    }
37}
38
39#[cfg(test)]
40trait TraitTester:
41    Copy + Clone + PartialEq + Eq + PartialOrd + Ord + ::std::hash::Hash + ::std::fmt::Debug
42{
43}
44
45#[cfg(test)]
46impl TraitTester for ClassAccessFlags {}