@Retention(value=CLASS)
@Target(value={METHOD,CONSTRUCTOR})
public @interface CWrapCatch
When wrapping an entire method:
When wrapping a method call instruction:
@CWrapCatch()
public String catchException(Exception e) {
//Rethrow the exception or return a default value
}
Wrapping a method call instruction:
@CWrapCatch(target = "...")
public String catchException(Exception e) {
//Rethrow the exception or return a default value
}
If your target has to be chosen more precisely you can use a slice() to narrow down the search.CSlice,
GitHub Wiki| Modifier and Type | Required Element and Description |
|---|---|
java.lang.String[] |
value
The method name and descriptor to inject into.
This supports multiple targets and wildcards. e.g. |
| Modifier and Type | Optional Element and Description |
|---|---|
int |
ordinal
The ordinal of target method call instruction.
Ignored if the entire method should be wrapped. |
CSlice |
slice
The slice to narrow down the search for the target.
Ignored if the entire method should be wrapped. |
java.lang.String |
target
The method owner, name and descriptor of the target method call instruction to wrap.
If this is not specified the entire method will be wrapped. e.g. |
public abstract java.lang.String[] value
print(Ljava/lang/String;)V or print*public abstract java.lang.String target
Ljava/io/InputStream;close()Vpublic abstract int ordinal
public abstract CSlice slice