22namespace PHPJava \Kernel \Structures \Annotations ;
33
44use PHPJava \Exceptions \NotImplementedException ;
5+ use PHPJava \Kernel \Attributes \AttributeInfo ;
56use PHPJava \Kernel \Attributes \RuntimeVisibleAnnotationsAttribute ;
67use PHPJava \Utilities \BinaryTool ;
78
@@ -11,12 +12,10 @@ final class ElementValuePairs implements AnnotationInterface
1112 use \PHPJava \Kernel \Core \ConstantPool;
1213
1314 private $ tag ;
14- private $ elementNameIndex = null ;
1515
1616 public function execute (): void
1717 {
18- $ this ->elementNameIndex = $ this ->readUnsignedShort ();
19- $ this ->tag = $ this ->readByte ();
18+ $ this ->tag = chr ($ this ->readByte ());
2019
2120 $ this ->constValueIndex = $ this ->readUnsignedShort ();
2221
@@ -28,20 +27,24 @@ public function execute(): void
2827
2928 $ this ->classInfoIndex = $ this ->readUnsignedShort ();
3029
31- $ this ->annotationValue = new RuntimeVisibleAnnotationsAttribute ($ this ->reader );
32- $ this ->annotationValue ->setConstantPool ($ this ->getConstantPool ());
33- $ this ->annotationValue ->execute ();
30+ $ cpInfo = $ this ->getConstantPool ()->getEntries ();
3431
35- $ this ->arrayValue = [
36- 'num_values ' => $ this ->readUnsignedShort (),
32+ if ($ this ->tag === '@ ' ) {
33+ $ this ->annotationValue = new AttributeInfo ($ this ->reader );
34+ $ this ->annotationValue ->setConstantPool ($ this ->getConstantPool ());
35+ $ this ->annotationValue ->execute ();
36+ }
3737
38- ];
38+ if ($ this ->tag === '[ ' ) {
39+ $ this ->arrayValue = [
40+ 'num_values ' => $ this ->readUnsignedShort (),
41+
42+ ];
43+ }
3944//
4045// for ($i = 0; $i < $this->arrayValue['num_values']; $i++) {
4146//
4247// }
4348
44- var_dump ($ this ->arrayValue );
45- exit ();
4649 }
4750}
0 commit comments