Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add MethodType_info structure
  • Loading branch information
m3m0r7 committed May 6, 2019
commit f3c7c518045256650eec147e7bd4ddbdc2485ef6
2 changes: 2 additions & 0 deletions src/Core/JVM/ConstantPool.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use PHPJava\Kernel\Structures\_Long;
use PHPJava\Kernel\Structures\_MethodHandle;
use PHPJava\Kernel\Structures\_Methodref;
use PHPJava\Kernel\Structures\_MethodType;
use PHPJava\Kernel\Structures\_NameAndType;
use PHPJava\Kernel\Structures\_String;
use PHPJava\Kernel\Structures\_Utf8;
Expand Down Expand Up @@ -85,6 +86,7 @@ private function read($entryTag): ?StructureInterface
case ConstantPoolTag::CONSTANT_MethodHandle:
return new _MethodHandle($this->reader);
case ConstantPoolTag::CONSTANT_MethodType:
return new _MethodType($this->reader);
case ConstantPoolTag::CONSTANT_Module:
case ConstantPoolTag::CONSTANT_Package:
throw new ReadEntryException('Entry tag ' . sprintf('0x%04X', $entryTag) . ' is not implemented.');
Expand Down
24 changes: 24 additions & 0 deletions src/Kernel/Structures/_MethodType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php
namespace PHPJava\Kernel\Structures;

use PHPJava\Exceptions\NotImplementedException;
use PHPJava\Utilities\BinaryTool;

class _MethodType implements StructureInterface
{
use \PHPJava\Kernel\Core\BinaryReader;
use \PHPJava\Kernel\Core\ConstantPool;
use \PHPJava\Kernel\Core\DebugTool;

private $descriptorIndex;

public function execute(): void
{
$this->descriptorIndex = $this->readUnsignedShort();
}

public function getDescriptorIndex(): int
{
return $this->descriptorIndex;
}
}