Add tests and enhancements for CIR and injection mechanics#1
Merged
Conversation
- Skip weaving for classes/methods with no injects or redirects. - Handle write failures with optional safe mode fallback. - Introduce `pathResolve` and `pathWeave` for detailed diagnostics. - Skip abstract and native method transformations. - Add `@SuppressWarnings` to avoid constant condition warnings.
…e hook parameter shapes: - Add support for hook descriptor shapes: `()V`, `(OWNER;)V`, `(args)V`, `(OWNER;args)V`. - Introduce type validation and operand marshaling logic for descriptor compatibility. - Adjust weaving logic in `AsmHookResolver`, `InjectHeadAdapter`, and `InjectTailAdapter` to support enhanced validation and descriptor matching. - Update `AsmWeaver` to pass owner, access, and descriptor into adapters.
- Standardize and improve documentation consistency across modules. - Replace MVP-specific notes with general descriptions or forward-looking statements. - Align terminology with current and planned feature design. - Add thread-safety notes and clarify method behaviors where relevant.
… descriptor validation: - Extend `InjectHeadAdapter` and `InjectTailAdapter` to support new hook shapes, including `CallbackInfo` support. - Introduce `HookShape` utility for classifying and validating hook descriptors. - Replace duplicated descriptor validation logic with reusable utility methods. - Add `CallbackInfo` class to support cancellation mechanics in hook executions.
…`, and `CallbackInfoReturnable`: - Add `Cancellable` interface to standardize runtime cancellation mechanics. - Introduce `CancellationException` for non-cancellable operation handling. - Implement `CallbackInfoReturnable` to support return value manipulation and cancellation.
- Introduce `cancellable` flag in `@Inject` to enable cancellation of target methods via `CallbackInfo` or `CallbackInfoReturnable`. - Update `@Inject` documentation to reflect cancellation support.
…escriptor handling: - Add `@Shadow` API for field and method remapping support. - Extend `HookShape` utility to support `CallbackInfoReturnable`. - Implement CIR-specific descriptor validation and argument handling. - Add operand emission methods for CIR initialization, loading, and return manipulation.
- Add `CIR_INTERNAL` for handling `CallbackInfoReturnable`. - Update hook shape matching to include CIR support. - Implement descriptor validation logic for CIR usage. - Introduce CIR initialization, operand marshalling, and return handling mechanics.
- Add `CIR_INTERNAL` for handling `CallbackInfoReturnable`. - Update hook shape matching to include CIR support. - Implement descriptor validation logic for CIR usage in tail injections. - Introduce CIR initialization, operand marshalling, and return handling mechanics.
…r enhanced callback handling: - Replace `MethodVisitor` with `InjectHeadAdapter`/`InjectTailAdapter` instances in `HookShape` methods. - Add method name and cancellable flag parameters to CallbackInfo creation logic for improved debugging. - Extend operand marshaling and return handling mechanics to support detailed CallbackInfo operations. - Introduce specialized methods for handling primitive return types in `CallbackInfoReturnable`.
- Introduce test resources for validating CI/CIR usage, including head, tail, and cancellation scenarios. - Add negative tests for invalid CI and CIR application (e.g., CI on non-void or CIR on void methods). - Validate CIR behavior for return value manipulation and cancellation. - Verify CI side effects and constructor injection support.
- Add comprehensive tests for CI and CIR behaviors, including head injections, return manipulation, and method cancellations. - Validate constructor injection and scenarios with and without return value manipulation. - Verify proper handling of mixin configurations for runtime behaviors and detailed assertions.
- Introduce tests for CI and CIR behaviors, including head injections, tail overrides, synchronized method handling, and return value manipulation. - Add priority resolution tests for CIR tail injections. - Validate mixin configurations and assertions for null and static behavior. - Add negative test for invalid CI usage on static methods.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview of Changes
This pull request introduces comprehensive end-to-end tests, refactors, and enhances framework capabilities for
CallbackInfoReturnable(CIR) and injection mechanics. Key changes include:Testing
Refactors
InjectHeadAdapterandInjectTailAdapterto improve callback handling and parameter validation.HookShapeutility for improved maintainability.Features
@Shadowannotation for field/method remapping.cancellableproperty in the@Injectannotation and aCancellationExceptionAPI.Remaining Tasks
Related Issues/Discussions
No issues referenced.
Thank you for reviewing these changes. Please provide feedback or suggest improvements!