Skip to content

Commit b6eb6ff

Browse files
authored
Merge pull request php-java#227 from php-java/feature/add-logger-to-invoke-opcode
Fix problems
2 parents 458420f + c1f70b5 commit b6eb6ff

5 files changed

Lines changed: 22 additions & 4 deletions

File tree

src/Core/JVM/Invoker/Extended/JavaMethodAnnotationAffectable.php renamed to src/Core/JVM/Invoker/Extended/JavaMethodAnnotationInjectable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
namespace PHPJava\Core\JVM\Invoker\Extended;
33

4-
trait JavaMethodAnnotationAffectable
4+
trait JavaMethodAnnotationInjectable
55
{
66
public function getAnnotations(string $name): array
77
{

src/Core/JVM/Invoker/JavaClassMethodInvoker.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class JavaClassMethodInvoker implements InvokerInterface
1313
use Extended\MethodListable;
1414
use Extended\ArgumentsStringifyable;
1515
use Extended\StaticConstructorInitializable;
16-
use Extended\JavaMethodAnnotationAffectable;
16+
use Extended\JavaMethodAnnotationInjectable;
1717
use Extended\JavaMethodSpecifiable;
1818

1919
/**

src/Kernel/Types/_Char.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ public static function isValid($value): bool
3131
protected static function filter($value)
3232
{
3333
if (ctype_alpha($value) && strlen($value) === 1) {
34-
return $value;
34+
return ord($value);
3535
}
36-
return json_decode(sprintf('"\\u%04X"', $value));
36+
return $value;
37+
}
38+
39+
public function __toString(): string
40+
{
41+
return json_decode(sprintf('"\\u%04X"', $this->value));
3742
}
3843
}

src/Packages/java/io/PrintStream.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@ public function print($methodSignature, $a = null)
140140
Output::write($arg->getString());
141141
return;
142142
}
143+
143144
if (is_scalar($arg) ||
144145
$arg instanceof Collection ||
145146
$arg instanceof PrimitiveValueInterface

src/Utilities/Formatter.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,18 @@ public static function beatifyOperandStackItems(array $operandStacks = []): stri
213213
$formattedItems[] = '< primitive value: ' . ((string) $operandStack) . ' >';
214214
continue;
215215
}
216+
if ($operandStack instanceof \ArrayIterator) {
217+
$formattedItems[] = '< array: ' . implode(
218+
', ',
219+
array_map(
220+
function ($value) {
221+
return static::beatifyOperandStackItems([$value]);
222+
},
223+
$operandStack->getArrayCopy()
224+
)
225+
) . ' >';
226+
continue;
227+
}
216228
$formattedItems[] = '< unknown: ' . ((string) $operandStack) . ' >';
217229
}
218230

0 commit comments

Comments
 (0)