* Initializes and returns the reflected Method object for Object.toString().
()
| 13 | * Initializes and returns the reflected Method object for Object.toString(). |
| 14 | */ |
| 15 | function getToStringMethodRef() { |
| 16 | try { |
| 17 | const Object = Java.use('java.lang.Object'); |
| 18 | const toStringMethod = Object.class.getDeclaredMethod("toString", []); |
| 19 | toStringMethod.setAccessible(true); |
| 20 | return toStringMethod; |
| 21 | } catch (e) { |
| 22 | console.log("❌ CRITICAL SETUP ERROR: Failed to prepare toString reflection: " + e); |
| 23 | return null; |
| 24 | } |
| 25 | } |
| 26 | |
| 27 | // Execute the reflection setup once at the start |
| 28 | const toStringMethodRef = getToStringMethodRef(); |