| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| drafts:mixin_injectors [2026/02/20 18:07] – [Attaching Data] add missing subject to sentence. (d_iscord_made_me_do_it) gauntrecluse | drafts:mixin_injectors [2026/02/20 20:39] (current) – [Injection Point, the value attribute] Add CTOR_HEAD injection point gauntrecluse |
|---|
| ^ String Form in Annotation ^ Function ^ | ^ String Form in Annotation ^ Function ^ |
| | ''HEAD'' | Inject at the earliest possible point in the method | | | ''HEAD'' | Inject at the earliest possible point in the method | |
| | | ''CTOR_HEAD'' | For constructors, inject at the earliest possible point after the super call. | |
| | ''RETURN'' | Inject before every ''RETURN'' instruction in the target method | | | ''RETURN'' | Inject before every ''RETURN'' instruction in the target method | |
| | ''TAIL'' | Inject before the very last ''RETURN'' instruction in the target method | | | ''TAIL'' | Inject before the very last ''RETURN'' instruction in the target method | |
| |
| ==== Slice ==== | ==== Slice ==== |
| A slice uses one or two additional ''@At''s to specify a range to include when searching for instructions matching the main ''@At'', it is usable for any injection point. Slicing is specified via the ''slice'' attribute, which takes a ''@Slice'' annotation (code differently formatted to distinguish between the different ''@At''s more clearly): | A slice uses one or two additional ''@At''s to specify a range to include when searching for instructions matching the main ''@At'', it is usable for any injection point. Slicing is specified via the ''slice'' attribute, which takes a ''@Slice'' annotation (code differently formatted to distinguish between the different ''@At''s more clearly), for example: |
| <code java> | <code java> |
| @At( | @InjectorAnnotation( |
| value = "INJECTION POINT", | method = "...", |
| | at = @At(...), |
| slice = @Slice( | slice = @Slice( |
| from = @At(...) | from = @At(...), |
| to = @At(...) | to = @At(...) |
| ) | ) |
| ) | ) |
| </code> | </code> |
| | ''from'' defaults to ''@At("HEAD")'', and ''to'' defaults to ''@At("TAIL")'', you may only specify one's value if needed. They otherwise can be specified as normal ''@At''s. |
| ''from'' defaults to ''@At("HEAD")'', and ''to'' defaults to ''@At("TAIL")'', you may only specify one's value if needed. | |
| |
| :!: When slicing, the default [[#injection_point_specifiers|specifier]] behavior of the injection point shifts from '':ALL'' to '':FIRST''. This means you must explicitly use '':ALL'' for the injector to be able to target multiple instructions within a slice. | :!: When slicing, the default [[#injection_point_specifiers|specifier]] behavior of the injection point shifts from '':ALL'' to '':FIRST''. This means you must explicitly use '':ALL'' for the injector to be able to target multiple instructions within a slice. |