Update code_inspections.md

This commit is contained in:
SUBYEAR 2020-05-22 17:08:01 +08:00 committed by GitHub
parent 9549adde22
commit f9322f071e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -84,7 +84,7 @@ The overridden `ComparingReferencesInspection` methods are discussed in the sect
### Visitor Implementation Class
The visitor class evaluates whether elements of the file's `PsiTree` are of interest to an inspection.
The `ComparingReferencesInspection.createOptionsPanel()` method creates an anonymous visitor class based on [`JavaElementVisitor`](upsource:///java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java) to traverse the `PsiTree` of the Java file being edited, inspecting for suspect syntax.
The `ComparingReferencesInspection.buildVisitor()` method creates an anonymous visitor class based on [`JavaElementVisitor`](upsource:///java/java-psi-api/src/com/intellij/psi/JavaElementVisitor.java) to traverse the `PsiTree` of the Java file being edited, inspecting for suspect syntax.
The anonymous class overrides three methods in particular.
* `visitReferenceExpression()` to prevent any duplicate visitation of reference-type expressions.
* `visitBinaryExpression()`, which does all the heavy lifting.