|
21 | 21 | use PHPJava\Kernel\Maps\OpCode; |
22 | 22 | use PHPJava\Kernel\Mnemonics\OperationInterface; |
23 | 23 | use PHPJava\Kernel\Structures\_MethodInfo; |
| 24 | +use PHPJava\Kernel\Types\_Char; |
24 | 25 | use PHPJava\Utilities\DebugTool; |
25 | 26 | use PHPJava\Utilities\Formatter; |
26 | 27 | use PHPJava\Utilities\SuperClassResolver; |
@@ -89,6 +90,13 @@ public function call(string $name, ...$arguments) |
89 | 90 | ->getJavaClass() |
90 | 91 | ->getConstantPool(); |
91 | 92 |
|
| 93 | + // Wrap _Char |
| 94 | + foreach ($arguments as &$argument) { |
| 95 | + if (is_string($argument) && strlen($argument) === 1) { |
| 96 | + $argument = new _Char($argument); |
| 97 | + } |
| 98 | + } |
| 99 | + |
92 | 100 | $constantPool = $currentConstantPool->getEntries(); |
93 | 101 |
|
94 | 102 | if ($name === '<init>' && $this->javaClassInvoker->getJavaClass()->hasParentClass()) { |
@@ -125,7 +133,7 @@ function ($argument) { |
125 | 133 | )['arguments']; |
126 | 134 |
|
127 | 135 | // does not strict mode can be PHP types |
128 | | - if (!($this->options['strict'] ?? Runtime::STRICT)) { |
| 136 | + if (!($this->options['strict'] ?? GlobalOptions::get('strict') ?? Runtime::STRICT)) { |
129 | 137 | $formattedArguments = Formatter::signatureConvertToAmbiguousForPHP($formattedArguments); |
130 | 138 | } |
131 | 139 |
|
@@ -209,6 +217,14 @@ function ($argument) { |
209 | 217 |
|
210 | 218 | $methodBeautified = Formatter::beatifyMethodFromConstantPool($method, $currentConstantPool); |
211 | 219 | $this->debugTool->getLogger()->info('Start operations: ' . $methodBeautified); |
| 220 | + |
| 221 | + $localStorage = array_map( |
| 222 | + function ($item) { |
| 223 | + return TypeResolver::convertPHPTypeToJavaType($item); |
| 224 | + }, |
| 225 | + $localStorage |
| 226 | + ); |
| 227 | + |
212 | 228 | while ($reader->getOffset() < $codeAttribute->getOpCodeLength()) { |
213 | 229 | if (++$executedCounter > ($this->options['max_stack_exceeded'] ?? GlobalOptions::get('max_stack_exceeded') ?? Runtime::MAX_STACK_EXCEEDED)) { |
214 | 230 | throw new RuntimeException( |
|
0 commit comments