File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Kernel \Annotations ;
3+
4+ use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Utilities \BinaryTool ;
6+
7+ final class Annotation implements AnnotationInterface
8+ {
9+ use \PHPJava \Kernel \Core \BinaryReader;
10+ use \PHPJava \Kernel \Core \ConstantPool;
11+
12+ private $ typeIndex = 0 ;
13+ private $ numElementValuePairs = 0 ;
14+ private $ elementValuePairs = [];
15+
16+ public function execute (): void
17+ {
18+ $ this ->typeIndex = $ this ->readUnsignedShort ();
19+ $ this ->numElementValuePairs = $ this ->readUnsignedShort ();
20+ for ($ i = 0 ; $ i < $ this ->numElementValuePairs ; $ i ++) {
21+ $ elementValuePair = (new ElementValuePairs ($ this ->reader ))
22+ ->setConstantPool ($ this ->getConstantPool ());
23+ $ elementValuePair ->execute ();
24+ $ this ->elementValuePairs [] = $ elementValuePair ;
25+ }
26+ }
27+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Kernel \Annotations ;
3+
4+ interface AnnotationInterface
5+ {
6+ public function execute (): void ;
7+ }
Original file line number Diff line number Diff line change 1+ <?php
2+ namespace PHPJava \Kernel \Annotations ;
3+
4+ use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Utilities \BinaryTool ;
6+
7+ final class ElementValuePairs implements AnnotationInterface
8+ {
9+ use \PHPJava \Kernel \Core \BinaryReader;
10+ use \PHPJava \Kernel \Core \ConstantPool;
11+
12+ private $ elementNameIndex = 0 ;
13+ private $ tag ;
14+
15+ public function execute (): void
16+ {
17+ $ this ->elementNameIndex = $ this ->readUnsignedShort ();
18+ $ this ->tag = $ this ->readByte ();
19+
20+ var_dump ($ this ->elementNameIndex , $ this ->tag );
21+ exit ();
22+ }
23+ }
Original file line number Diff line number Diff line change @@ -9,8 +9,8 @@ final class DeprecatedAttribute implements AttributeInterface
99 use \PHPJava \Kernel \Core \BinaryReader;
1010 use \PHPJava \Kernel \Core \ConstantPool;
1111
12+
1213 public function execute (): void
1314 {
14- throw new NotImplementedException (__CLASS__ );
1515 }
1616}
Original file line number Diff line number Diff line change 22namespace PHPJava \Kernel \Attributes ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Annotations \Annotation ;
56use PHPJava \Utilities \BinaryTool ;
67
78final class RuntimeVisibleAnnotationsAttribute implements AttributeInterface
89{
910 use \PHPJava \Kernel \Core \BinaryReader;
1011 use \PHPJava \Kernel \Core \ConstantPool;
1112
13+ private $ numAnnotations = 0 ;
14+ private $ annotations = [];
15+
1216 public function execute (): void
1317 {
14- throw new NotImplementedException (__CLASS__ );
18+ $ this ->numAnnotations = $ this ->readUnsignedShort ();
19+ for ($ i = 0 ; $ i < $ this ->numAnnotations ; $ i ++) {
20+ $ annotation = new Annotation ($ this ->reader );
21+ $ annotation ->setConstantPool ($ this ->getConstantPool ());
22+ $ annotation ->execute ();
23+ $ this ->annotations [] = $ annotation ;
24+ }
1525 }
1626}
You can’t perform that action at this time.
0 commit comments