| Enum | Description |
|---|---|
| CASM.Shift |
| Annotation Type | Description |
|---|---|
| CASM |
Inject into a method using direct ASM.
You get direct access to the class/method node of the target. The transformer methods have to be static and return void.By default, the transformer will be executed at the top of the handler chain. You can change this by setting the CASM.shift() value to CASM.Shift.BOTTOM.The code inside the method is isolated from the rest of the class and loaded. Fields inside the transformer class are not accessible from the isolated method. Methods accessed from the isolated method are getting copied into the isolated class. Lambdas are not supported and will throw an exception during the isolation process. Injecting into a class: |
| CInject |
Inject into a method at various targets.
The original code flow can be cancelled and own values can be returned. The transformer method has to return void and can have the following arguments:The arguments of the target method A InjectionCallback for cancelling the original method and returning values
If the target method is static the transformer method has to be static as well.The arguments have to be in the same order as the target method but are not required. |
| CModifyConstant |
Modify a constant value in a method.
The target constant must exactly match the given value. If the target is not found an exception will be thrown unless CModifyConstant.optional() is set to true.The following types are supported: CModifyConstant.nullValue()
CModifyConstant.intValue()
CModifyConstant.longValue()
CModifyConstant.floatValue()
CModifyConstant.doubleValue()
CModifyConstant.stringValue()
CModifyConstant.typeValue()
The transformer method has to return the same type as the target constant and needs to be static if the target method is static.The transformer method can optionally take the same type as the target constant as the first argument (except for CModifyConstant.nullValue()). |
| CModifyExpressionValue |
Modify the value of an expression (method call/field access/new object creation).
When modifying the value (return value) of a method call, the target method must return a value and not be void. Field values can be modified with field gets ( GETFIELD/GETSTATIC) and field sets (PUTFIELD/PUTSTATIC).New object creations can be modified with the NEW target.The transformer method must have the modified value type as the only parameter and return type. If the transformer target method is static, the transformer method must be static as well. Modify the return value of a method call: |
| COverride |
Override a method in a class.
The transformer method must have the same parameters and return type as the overridden method. The access of the transformer method has to be higher or equal to the overridden method (private < package private < protected < public). If the overridden method is static, the transformer method has to be static as well. Overriding a method: |
| CRecordComponent |
Add a field as a record component and add the corresponding getter methods.
This also adds a new constructor to the record class with all added record components. The Object.toString()/Object.equals(Object)/Object.hashCode() methods get reimplemented with the new components. |
| CRedirect |
Redirect a specified method call or field access.
The following target types are supported: INVOKE FIELD GETFIELD PUTFIELD NEW |
| CWrapCatch |
Wrap an entire method or a single method call in a try-catch block.
The transformer method must have the caught exception as the only parameter. |
| CWrapCondition |
This annotation is used to wrap a method call or a field with a condition (if statement).
The return type of the transformer method must always be a boolean. |