Skip to content

Commit e1b1465

Browse files
kezhenxu94wu-sheng
authored andcommitted
Add attention note to plugin development guide (apache#3245)
1 parent 90d525b commit e1b1465

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/en/guides/Java-Plugin-Development-Guide.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ ClassMatch represents how to match the target classes, there are 4 ways:
225225
* byHierarchyMatch, through the class's parent classes or interfaces
226226

227227
**Attentions**:
228-
* Forbid to use `*.class.getName()` to get the class String name. Recommend you to use literal String. This is for
228+
* Never use `ThirdPartyClass.class` in the instrumentation definitions, such as `takesArguments(ThirdPartyClass.class)`, or `byName(ThirdPartyClass.class.getName())`, because of the fact that `ThirdPartyClass` dose not necessarily exist in the target application and this will break the agent; we have `import` checks to help on checking this in CI, but it doesn't cover all scenarios of this limitation, so never try to work around this limitation by something like using full-qualified-class-name (FQCN), i.e. `takesArguments(full.qualified.ThirdPartyClass.class)` and `byName(full.qualified.ThirdPartyClass.class.getName())` will pass the CI check, but are still invalid in the agent codes, **Use Full Qualified Class Name String Literature Instead**.
229+
* Even you are perfectly sure that the class to be intercepted exists in the target application (such as JDK classes), still, don't use `*.class.getName()` to get the class String name. Recommend you to use literal String. This is for
229230
avoiding ClassLoader issues.
230231
* `by*AnnotationMatch` doesn't support the inherited annotations.
231232
* Don't recommend to use `byHierarchyMatch`, unless it is really necessary. Because using it may trigger intercepting

0 commit comments

Comments
 (0)