@@ -19,43 +19,47 @@ public function __destruct()
1919
2020 public function __call ($ name , $ arguments )
2121 {
22+ $ defaultName = '__default_ ' . $ name ;
23+ if (method_exists ($ this , $ defaultName )) {
24+ return $ this ->{$ defaultName }(...$ arguments );
25+ }
2226 throw new NoSuchMethodException ($ name . ' does not exist on ' . get_class ($ this ));
2327 }
2428
25- public function clone (): _Object
29+ public function __default_clone (): _Object
2630 {
2731 return clone $ this ;
2832 }
2933
30- public function equals ($ a = null )
34+ public function __default_equals ($ a = null )
3135 {
3236 return $ this === $ a ;
3337 }
3438
35- public function getClass (): self
39+ public function __default_getClass (): self
3640 {
3741 return $ this ;
3842 }
3943
40- public function hashCode ()
44+ public function __default_hashCode ()
4145 {
4246 if (version_compare (PHP_VERSION , '7.2 ' , '< ' )) {
4347 return crc32 (spl_object_hash ($ this ));
4448 }
4549 return spl_object_id ($ this );
4650 }
4751
48- public function notify (): void
52+ public function __default_notify (): void
4953 {
5054 // not implemented.
5155 }
5256
53- public function notifyAll (): void
57+ public function __default_notifyAll (): void
5458 {
5559 // not implemented.
5660 }
5761
58- public function toString ( $ a = null )
62+ public function __default_toString ( )
5963 {
6064 return 'java.lang.Object@PHPJava ' . spl_object_hash ($ this );
6165 }
@@ -65,12 +69,12 @@ public function __toString(): string
6569 return $ this ->toString ();
6670 }
6771
68- public function wait (int $ timeout = null , int $ nanos = null ): void
72+ public function __default_wait (int $ timeout = null , int $ nanos = null ): void
6973 {
7074 // not implemented.
7175 }
7276
73- public function finalize (): void
77+ public function __default_finalize (): void
7478 {
7579 }
7680}
0 commit comments