Skip to content

Commit 3ea4b00

Browse files
committed
WIP
1 parent f2009f1 commit 3ea4b00

2 files changed

Lines changed: 19 additions & 12 deletions

File tree

src/Kernel/Structures/Annotations/Annotation.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ public function execute(): void
1919
$this->numElementValuePairs = $this->readUnsignedShort();
2020

2121
for ($i = 0; $i < $this->numElementValuePairs; $i++) {
22+
$elementNameIndex = $this->readUnsignedShort();
2223
$elementValuePair = (new ElementValuePairs($this->reader))
2324
->setConstantPool($this->getConstantPool());
2425
$elementValuePair->execute();
25-
$this->elementValuePairs[] = $elementValuePair;
26+
$this->elementValuePairs[] = [
27+
'element_name_index' => $elementNameIndex,
28+
'element_value_pair' => $elementValuePair,
29+
];
2630
}
2731
}
2832
}

src/Kernel/Structures/Annotations/ElementValuePairs.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
namespace PHPJava\Kernel\Structures\Annotations;
33

44
use PHPJava\Exceptions\NotImplementedException;
5+
use PHPJava\Kernel\Attributes\AttributeInfo;
56
use PHPJava\Kernel\Attributes\RuntimeVisibleAnnotationsAttribute;
67
use 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

Comments
 (0)