Skip to content

Commit 32d51c2

Browse files
committed
Update
1 parent a4f1ca3 commit 32d51c2

10 files changed

Lines changed: 253 additions & 246 deletions

File tree

src/bridge/java/io/PrintStream.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class PrintStream
88
{
9-
9+
private $sequence = '';
1010
public function println($arg)
1111
{
1212
if ($arg instanceof _Utf8) {
@@ -23,4 +23,10 @@ public function println($arg)
2323
}
2424
}
2525

26+
public function append($string)
27+
{
28+
$this->sequence .= $string;
29+
return $this;
30+
}
31+
2632
}

src/bridge/java/lang/StringBuilder.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
class StringBuilder
66
{
77
private $sequence = '';
8+
89
public function append($arg)
910
{
1011
if ($arg instanceof _String) {
@@ -16,18 +17,16 @@ public function append($arg)
1617
$this->sequence .= $arg;
1718
}
1819
return $this;
19-
2020
}
2121

22-
public function toString($arg = null)
22+
public function toString()
2323
{
2424
return $this->sequence;
2525
}
2626

2727
public function __toString()
2828
{
2929
return $this->sequence;
30-
3130
}
3231

3332
}

src/kernel/mnemonics/_aaload.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public function execute(): void
2020
if (!isset($arrayref[$index])) {
2121
throw new \PHPJava\Bridge\java\lang\ArrayIndexOutOfBoundsException('Array Index ' . $index . ' out of bounds.');
2222
}
23-
2423
$this->pushStack($arrayref[$index]);
2524
}
2625
}

src/kernel/mnemonics/_anewarray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function execute(): void
2222
// 空の配列を渡す (nullで埋める)
2323
$count = $this->getStack();
2424
// need reference
25-
$ref = new ArrayIterator(array_fill(0, $count, null));
25+
$ref = new \ArrayIterator(array_fill(0, $count, null));
2626
$this->pushStackByReference($ref);
2727
}
2828
}

src/kernel/mnemonics/_invokespecial.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function execute(): void
3030
}
3131

3232
$methodName = $cpInfo[$nameAndTypeIndex->getNameIndex()]->getString();
33-
var_dump($methodName);
33+
// var_dump($methodName);
3434

3535
// $result = call_user_func_array(
3636
// [$this->javaClassInvoker->getDynamicMethods(), $methodName],

src/kernel/mnemonics/_invokevirtual.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ public function execute(): void
2424
for ($i = 0; $i < $signature['arguments_count']; $i++) {
2525
$arguments[] = $this->getStack();
2626
}
27-
2827
$invokerClass = $this->getStack();
2928

3029
$javaObjectName = str_replace('/', '\\', $class);
@@ -35,10 +34,13 @@ public function execute(): void
3534
}
3635

3736
$invokerClassName = '\\PHPJava\\Bridge\\' . $javaObjectName;
38-
$result = call_user_func_array([
39-
new $invokerClassName,
40-
$cpInfo[$cpInfo[$cp->getNameAndTypeIndex()]->getNameIndex()]->getString()
41-
], $arguments);
37+
$result = call_user_func_array(
38+
[
39+
$invokerClass,
40+
$cpInfo[$cpInfo[$cp->getNameAndTypeIndex()]->getNameIndex()]->getString()
41+
],
42+
$arguments
43+
);
4244

4345
if ($signature[0]['type'] !== 'void') {
4446
$this->pushStack($result);

src/kernel/mnemonics/_newarray.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function execute(): void
1515
$count = $this->getStack();
1616

1717
// need reference
18-
$ref = new ArrayIterator(array_fill(0, $count, null));
18+
$ref = new \ArrayIterator(array_fill(0, $count, null));
1919
$this->pushStackByReference($ref);
2020
}
2121
}

src/utilities/Formatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static function parseSignature($signature, $i = 0)
7171
$build .= $signature[$i];
7272
}
7373
$data['arguments'] = ($build !== '') ? static::parseSignature($build) : [];
74-
$data['arguments_count'] = ($data['arguments_count'] ?? 0) + 1;
74+
$data['arguments_count'] = count($data['arguments']);
7575
break;
7676
}
7777
$i++;

tools/Test.class

2.35 KB
Binary file not shown.

0 commit comments

Comments
 (0)