4
4
/// itself, it doesn't represent every byte in the class definition, though, many information are
5
5
/// encoded in the type system instead. This approach may seem restrictive but it helps achieving
6
6
/// bytecode safety.
7
- #[ derive( Debug ) ]
7
+ #[ derive( Debug , PartialEq ) ]
8
8
pub struct Classfile {
9
9
pub version : ClassfileVersion ,
10
10
pub constant_pool : ConstantPool ,
@@ -66,7 +66,7 @@ impl Default for ClassfileVersion {
66
66
///
67
67
/// A `ConstantPool` is a table of various string and number literal constants that are referred
68
68
/// within the substructures of the `Classfile`.
69
- #[ derive( Debug ) ]
69
+ #[ derive( Debug , PartialEq ) ]
70
70
pub struct ConstantPool {
71
71
pub constants : Vec < Constant >
72
72
}
@@ -239,7 +239,7 @@ impl ReferenceKind {
239
239
}
240
240
}
241
241
242
- #[ derive( Default , Debug ) ]
242
+ #[ derive( Default , Debug , PartialEq ) ]
243
243
pub struct AccessFlags {
244
244
pub flags : u16
245
245
}
@@ -323,23 +323,23 @@ pub enum ParameterAccessFlags {
323
323
Mandated = 0x8000
324
324
}
325
325
326
- #[ derive( Default , Debug ) ]
326
+ #[ derive( Default , Debug , PartialEq ) ]
327
327
pub struct Field {
328
328
pub access_flags : AccessFlags ,
329
329
pub name_index : ConstantPoolIndex ,
330
330
pub descriptor_index : ConstantPoolIndex ,
331
331
pub attributes : Vec < Attribute >
332
332
}
333
333
334
- #[ derive( Default , Debug ) ]
334
+ #[ derive( Default , Debug , PartialEq ) ]
335
335
pub struct Method {
336
336
pub access_flags : AccessFlags ,
337
337
pub name_index : ConstantPoolIndex ,
338
338
pub descriptor_index : ConstantPoolIndex ,
339
339
pub attributes : Vec < Attribute >
340
340
}
341
341
342
- #[ derive( Debug ) ]
342
+ #[ derive( Debug , PartialEq ) ]
343
343
pub enum Attribute {
344
344
ConstantValue ( ConstantPoolIndex ) ,
345
345
Code { max_stack : u16 , max_locals : u16 , code : Vec < Instruction > , exception_table : Vec < ExceptionHandler > , attributes : Vec < Attribute > } ,
@@ -367,7 +367,7 @@ pub enum Attribute {
367
367
RawAttribute { name_index : ConstantPoolIndex , info : Vec < u8 > }
368
368
}
369
369
370
- #[ derive( Debug ) ]
370
+ #[ derive( Debug , PartialEq ) ]
371
371
pub enum StackMapFrame {
372
372
SameFrame { tag : u8 } ,
373
373
SameLocals1StackItemFrame { tag : u8 , stack : VerificationType } ,
@@ -394,7 +394,7 @@ impl StackMapFrame {
394
394
}
395
395
}
396
396
397
- #[ derive( Debug ) ]
397
+ #[ derive( Debug , PartialEq ) ]
398
398
pub enum VerificationType {
399
399
Top ,
400
400
Integer ,
@@ -417,29 +417,29 @@ impl VerificationType {
417
417
}
418
418
}
419
419
420
- #[ derive( Debug ) ]
420
+ #[ derive( Debug , PartialEq ) ]
421
421
pub struct ExceptionHandler {
422
422
pub start_pc : u16 ,
423
423
pub end_pc : u16 ,
424
424
pub handler_pc : u16 ,
425
425
pub catch_type : ConstantPoolIndex
426
426
}
427
427
428
- #[ derive( Debug ) ]
428
+ #[ derive( Debug , PartialEq ) ]
429
429
pub struct InnerClass {
430
430
pub inner_class_info_index : ConstantPoolIndex ,
431
431
pub outer_class_info_index : ConstantPoolIndex ,
432
432
pub inner_name_index : ConstantPoolIndex ,
433
433
pub access_flags : AccessFlags
434
434
}
435
435
436
- #[ derive( Debug ) ]
436
+ #[ derive( Debug , PartialEq ) ]
437
437
pub struct LineNumberTable {
438
438
pub start_pc : u16 ,
439
439
pub line_number : u16
440
440
}
441
441
442
- #[ derive( Debug ) ]
442
+ #[ derive( Debug , PartialEq ) ]
443
443
pub struct LocalVariableTable {
444
444
pub start_pc : u16 ,
445
445
pub length : u16 ,
@@ -448,7 +448,7 @@ pub struct LocalVariableTable {
448
448
pub index : u16
449
449
}
450
450
451
- #[ derive( Debug ) ]
451
+ #[ derive( Debug , PartialEq ) ]
452
452
pub struct LocalVariableTypeTable {
453
453
pub start_pc : u16 ,
454
454
pub length : u16 ,
@@ -457,7 +457,7 @@ pub struct LocalVariableTypeTable {
457
457
pub index : u16
458
458
}
459
459
460
- #[ derive( Debug ) ]
460
+ #[ derive( Debug , PartialEq ) ]
461
461
pub struct Annotation {
462
462
pub type_index : ConstantPoolIndex ,
463
463
pub element_value_pairs : Vec < ElementValuePair >
@@ -470,7 +470,7 @@ impl Annotation {
470
470
}
471
471
}
472
472
473
- #[ derive( Debug ) ]
473
+ #[ derive( Debug , PartialEq ) ]
474
474
pub struct ElementValuePair {
475
475
pub element_name_index : ConstantPoolIndex ,
476
476
pub value : ElementValue
@@ -482,7 +482,7 @@ impl ElementValuePair {
482
482
}
483
483
}
484
484
485
- #[ derive( Debug ) ]
485
+ #[ derive( Debug , PartialEq ) ]
486
486
pub enum ElementValue {
487
487
ConstantValue ( u8 , ConstantPoolIndex ) ,
488
488
Enum { type_name_index : ConstantPoolIndex , const_name_index : ConstantPoolIndex } ,
@@ -503,7 +503,7 @@ impl ElementValue {
503
503
}
504
504
}
505
505
506
- #[ derive( Debug ) ]
506
+ #[ derive( Debug , PartialEq ) ]
507
507
pub struct TypeAnnotation {
508
508
pub target_info : TargetInfo ,
509
509
pub target_path : TypePath ,
@@ -517,7 +517,7 @@ impl TypeAnnotation {
517
517
}
518
518
}
519
519
520
- #[ derive( Debug ) ]
520
+ #[ derive( Debug , PartialEq ) ]
521
521
pub enum TargetInfo {
522
522
TypeParameter { subtype : u8 , idx : u8 } ,
523
523
SuperType { idx : u16 } ,
@@ -563,7 +563,7 @@ impl TargetInfo {
563
563
}
564
564
}
565
565
566
- #[ derive( Debug ) ]
566
+ #[ derive( Debug , PartialEq ) ]
567
567
pub struct TypePath {
568
568
pub path : Vec < ( TypePathKind , u8 ) >
569
569
}
@@ -574,7 +574,7 @@ impl TypePath {
574
574
}
575
575
}
576
576
577
- #[ derive( Debug ) ]
577
+ #[ derive( Debug , PartialEq ) ]
578
578
pub enum TypePathKind {
579
579
Array , // Annotation is deeper in an array type
580
580
Nested , // Annotation is deeper in a nested type
@@ -593,7 +593,7 @@ impl TypePathKind {
593
593
}
594
594
}
595
595
596
- #[ derive( Debug ) ]
596
+ #[ derive( Debug , PartialEq ) ]
597
597
pub struct BootstrapMethod {
598
598
pub bootstrap_method_ref : ConstantPoolIndex ,
599
599
pub bootstrap_arguments : Vec < ConstantPoolIndex >
@@ -602,7 +602,7 @@ pub struct BootstrapMethod {
602
602
impl BootstrapMethod {
603
603
}
604
604
605
- #[ derive( Debug ) ]
605
+ #[ derive( Debug , PartialEq ) ]
606
606
pub struct MethodParameter {
607
607
pub name_index : ConstantPoolIndex ,
608
608
pub access_flags : AccessFlags
@@ -613,7 +613,7 @@ impl MethodParameter {
613
613
}
614
614
615
615
#[ allow( non_camel_case_types) ]
616
- #[ derive( Debug ) ]
616
+ #[ derive( Debug , PartialEq ) ]
617
617
pub enum Instruction {
618
618
AALOAD ,
619
619
AASTORE ,
0 commit comments