Skip to content

Commit 36ae3ff

Browse files
committed
constructorの不具合修正
1 parent e92efb1 commit 36ae3ff

5 files changed

Lines changed: 24 additions & 19 deletions

File tree

PHPJava/Attributes/JavaStackMapTableAttribute.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,11 @@ public function __construct (&$Class) {
1919

2020
}
2121

22-
// $this->AttributeData = new $classAttributeName($Class);
22+
}
23+
24+
public function getStackMapFrames () {
2325

26+
return $this->StackMapFrames;
2427

2528
}
2629

PHPJava/Invoker/JavaMethodInvoker.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

PHPJava/Statements/JavaStatement_iadd.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public function execute () {
66

77
$leftValue = $this->getStack();
88
$rightValue = $this->getStack();
9-
9+
1010
$this->pushStack(BinaryTools::add($leftValue, $rightValue, 4));
1111

1212
}

PHPJava/Statements/JavaStatement_invokevirtual.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ public function execute () {
2121
$arguments[] = $this->getStack();
2222

2323
}
24-
24+
2525
$invokerClass = $this->getStack();
26-
26+
2727
if ($invokerClass instanceof \JavaClass) {
2828

2929
$result = call_user_func_array(array(
@@ -38,18 +38,14 @@ public function execute () {
3838

3939
// load platform
4040
$this->getInvoker()->loadPlatform($class);
41-
$cp->getClass()->traceDump();
41+
$invokerClassName = '\\' . str_replace('/', '\\', $class);
4242

4343
$result = call_user_func_array(array(
44-
44+
4545
$invokerClass,
4646
$cpInfo[$cpInfo[$cp->getNameAndTypeIndex()]->getNameIndex()]->getString()
4747

4848
), $arguments);
49-
50-
// empty to array
51-
// $stacks = array();
52-
5349

5450
}
5551

PHPJava/Utils/BinaryTools.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public final static function multiply ($value1, $value2, $bytes) {
130130
}
131131

132132
public final static function add ($value1, $value2, $bytes) {
133-
133+
134134
if (function_exists('gmp_add')) {
135135

136136
$a = gmp_init($value1);

0 commit comments

Comments
 (0)