@@ -95,15 +95,17 @@ public function __call ($methodName, $arguments) {
9595 foreach ($ this ->getClass ()->getMethods () as $ methodInfo ) {
9696
9797 $ cpMethodName = $ cpInfo [$ methodInfo ->getNameIndex ()]->getString ();
98-
98+
9999 if ($ methodName === $ cpMethodName ) {
100100
101101 $ accessibility = $ this ->_getAccessiblity ($ methodInfo );
102102
103103 // メソッドのシグネチャを取得する
104104 $ javaArguments = JavaClass::parseSignature ($ cpInfo [$ methodInfo ->getDescriptorIndex ()]->getString ());
105105
106- if (sizeof ($ arguments ) !== $ javaArguments ['argumentsCount ' ]) {
106+ $ argumentsCount = sizeof ($ arguments );
107+
108+ if ($ argumentsCount !== $ javaArguments ['argumentsCount ' ]) {
107109
108110 // 引数の配列の大きさが違う
109111 continue ;
@@ -127,9 +129,6 @@ public function __call ($methodName, $arguments) {
127129
128130 if ($ attributeData instanceof \JavaCodeAttribute) {
129131
130- // runnable code
131- $ opCodes = $ attributeData ->getOpCodes ();
132-
133132 $ handle = fopen ('php://memory ' , 'rw ' );
134133 fwrite ($ handle , $ attributeData ->getCode ());
135134 rewind ($ handle );
@@ -138,13 +137,18 @@ public function __call ($methodName, $arguments) {
138137
139138 // 局所変数格納用
140139 $ localstorage = array (
141- 0 => $ this -> getClass () ,
140+ 0 => null ,
142141 1 => null ,
143142 2 => null ,
144143 3 => null
145144 );
145+
146+ $ i = 0 ;
147+ if ($ this ->_constructed ) {
148+ $ localstorage [0 ] = $ this ->getClass ();
149+ $ i = 1 ;
150+ }
146151
147- $ i = 1 ;
148152 foreach ($ arguments as $ argument ) {
149153
150154 $ localstorage [$ i ] = $ argument ;
@@ -191,12 +195,14 @@ public function __call ($methodName, $arguments) {
191195 }
192196
193197 }
198+
199+ return ;
194200
195201 }
196202
197203
198204 }
199-
205+
200206 throw new JavaInvokerException ('undefined method " ' . $ methodName . '" ' );
201207
202208 }
0 commit comments