11<?php
22namespace PHPJava \Compiler \Builder ;
33
4- use PHPJava \Compiler \Builder \Finder \Result \FinderResultInterface ;
54use PHPJava \Compiler \Builder \Maps \EntryMap ;
5+ use PHPJava \Compiler \Lang \Assembler \Traits \ConstantPoolManageable ;
6+ use PHPJava \Compiler \Lang \Assembler \Traits \Enhancer \ConstantPoolEnhanceable ;
67
78class Method implements BuilderInterface, EntryInterface
89{
10+ use ConstantPoolManageable;
11+ use ConstantPoolEnhanceable;
12+
913 private $ attributes = [];
1014 private $ accessFlags = 0 ;
1115
1216 /**
13- * @var FinderResultInterface
17+ * @var string
18+ */
19+ private $ className ;
20+
21+ /**
22+ * @var string
1423 */
15- private $ nameIndex ;
24+ private $ name ;
1625
1726 /**
18- * @var FinderResultInterface
27+ * @var string
1928 */
20- private $ descriptorIndex ;
29+ private $ descriptor ;
2130
2231 public function __construct (
2332 int $ accessFlags ,
24- FinderResultInterface $ nameIndex ,
25- FinderResultInterface $ descriptorIndex
33+ string $ className ,
34+ string $ name ,
35+ string $ descriptor
2636 ) {
2737 $ this ->accessFlags = $ accessFlags ;
28- $ this ->nameIndex = $ nameIndex ;
29- $ this ->descriptorIndex = $ descriptorIndex ;
38+ $ this ->className = $ className ;
39+ $ this ->name = $ name ;
40+ $ this ->descriptor = $ descriptor ;
3041 }
3142
3243 public function getAccessFlags (): int
3344 {
3445 return $ this ->accessFlags ;
3546 }
3647
48+ public function getClassName (): string
49+ {
50+ return $ this ->className ;
51+ }
52+
53+ public function getName (): string
54+ {
55+ return $ this ->name ;
56+ }
57+
58+ public function getDescriptor (): string
59+ {
60+ return $ this ->descriptor ;
61+ }
62+
3763 public function getNameIndex (): int
3864 {
3965 /**
4066 * @var EntryMap $result
4167 */
42- $ result = $ this ->nameIndex ->getResult ();
68+ $ result = $ this ->getEnhancedConstantPool ()
69+ ->findUtf8 ($ this ->name )
70+ ->getResult ();
4371 return $ result
4472 ->getEntryIndex ();
4573 }
@@ -49,7 +77,9 @@ public function getDescriptorIndex(): int
4977 /**
5078 * @var EntryMap $result
5179 */
52- $ result = $ this ->descriptorIndex ->getResult ();
80+ $ result = $ this ->getEnhancedConstantPool ()
81+ ->findUtf8 ($ this ->descriptor )
82+ ->getResult ();
5383 return $ result
5484 ->getEntryIndex ();
5585 }
0 commit comments