Skip to content

Implement constructor invocation APIs in LSPosedContext#533

Merged
JingMatrix merged 1 commit intomasterfrom
api
Feb 13, 2026
Merged

Implement constructor invocation APIs in LSPosedContext#533
JingMatrix merged 1 commit intomasterfrom
api

Conversation

@JingMatrix
Copy link
Copy Markdown
Owner

Unlike the existing newInstance variants which allocate and return a new object, these new APIs execute constructor logic on an existing, pre-allocated instance (thisObject). This separation of allocation and initialization allows for invoking original or super constructors within hook callbacks where the object reference is already established.

The implementation leverages the existing JNI HookBridge methods, as invokeOriginalMethod and invokeSpecialMethod already support void-return signatures required for constructor execution.

Unlike the existing `newInstance` variants which allocate and return a new object, these new APIs execute constructor logic on an existing, pre-allocated instance (`thisObject`). This separation of allocation and initialization allows for invoking original or super constructors within hook callbacks where the object reference is already established.

The implementation leverages the existing JNI `HookBridge` methods, as `invokeOriginalMethod` and `invokeSpecialMethod` already support void-return signatures required for constructor execution.
@JingMatrix JingMatrix merged commit d61aa69 into master Feb 13, 2026
1 check passed
JingMatrix added a commit that referenced this pull request Feb 14, 2026
Unlike the existing `newInstance` variants which allocate and return a new object, these new APIs execute constructor logic on an existing, pre-allocated instance (`thisObject`). This separation of allocation and initialization allows for invoking original or super constructors within hook callbacks where the object reference is already established.

The implementation leverages the existing JNI `HookBridge` methods, as `invokeOriginalMethod` and `invokeSpecialMethod` already support void-return signatures required for constructor execution.

Co-authored-by: frknkrc44 <krc440002@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant