11<?php
22namespace PHPJava \Core ;
33
4- use PHPJava \Core \JVM \Field \GetFieldInterface ;
4+ use PHPJava \Core \JVM \Field \FieldInterface ;
55use PHPJava \Core \JVM \Invoker \Invokable ;
66use PHPJava \Core \JVM \Invoker \InvokerInterface ;
77use PHPJava \Kernel \Maps \AccessFlag ;
@@ -55,6 +55,9 @@ public function __construct(JavaClass $javaClass)
5555 $ this ->staticFields [$ fieldName ] = $ fieldInfo ;
5656 }
5757 }
58+
59+ // call <clinit>
60+ $ this ->getStaticMethods ()->{'<clinit> ' }();
5861 }
5962
6063 public function getJavaClass (): JavaClass
@@ -69,16 +72,16 @@ public function getDynamicMethods(): InvokerInterface
6972
7073 public function getStaticMethods (): InvokerInterface
7174 {
72- return new JVM \Invoker \StaticMethodInvoker ($ this , $ this ->dynamicMethods );
75+ return new JVM \Invoker \StaticMethodInvoker ($ this , $ this ->staticMethods );
7376 }
7477
75- public function getDynamicFields (): GetFieldInterface
78+ public function getDynamicFields (): FieldInterface
7679 {
77- return new JVM \Field \DynamicFieldGetter ($ this , $ this ->dynamicFields );
80+ return new JVM \Field \DynamicField ($ this , $ this ->dynamicFields );
7881 }
7982
80- public function getStaticFields (): GetFieldInterface
83+ public function getStaticFields (): JVM \ Field \ StaticField
8184 {
82- return new JVM \Field \StaticFieldGetter ( $ this , $ this -> staticFields );
85+ return new JVM \Field \StaticField ( );
8386 }
8487}
0 commit comments