@Retention(value=RUNTIME) @Target(value=METHOD) public @interface Replacement
Replacement method MUST have the same return type, and
match name/signature of replaced method, but last parameter being a
String id template.
However, if replacing a non-static method, then the replacement MUST
still be static, and have as first parameter the caller.
null, then no new target should be registered.
However, we might still want to do taint analysis.
This is the case when instrumenting third-party libraries.
ThirdPartyMethodReplacementClass.| Modifier and Type | Required Element and Description |
|---|---|
ReplacementCategory |
category |
ReplacementType |
type
There might be different reasons to replace a methods,
like dealing with methods that return booleans, or might throw
an exception
|
| Modifier and Type | Optional Element and Description |
|---|---|
String |
castTo
Name of the class for which the return value of this method should be cast to.
|
String[] |
extraPackagesToConsider
Only applicable if UsageFilter is ONLY_SUT
|
String |
id
Give an id to this replacement method.
|
boolean |
isPure
Whether the method has side-effects.
|
String[] |
packagesToSkip
Method replacement will not be applied to classes in given prefix package.
|
boolean |
replacingConstructor
Specify if the target to replace is a constructor call, ie, using "new".
|
boolean |
replacingStatic
Specify if the target replaced method was static
|
UsageFilter |
usageFilter
Specify where the transformation can be applied.
|
public abstract ReplacementType type
public abstract ReplacementCategory category
public abstract boolean replacingStatic
public abstract boolean replacingConstructor
public abstract String id
public abstract UsageFilter usageFilter
public abstract boolean isPure
public abstract String castTo
public abstract String[] packagesToSkip
public abstract String[] extraPackagesToConsider
Copyright © 2016–2024. All rights reserved.