How to create complex Structural Search Inspection with condition
Answered
Hello,
I need to detect absence of some annotation on Class or Method with condition:
if (noClassAnnotation) {
if (noMethodAnnotation) {
error();
}
}
I made two Search Inspections to make this checks separately. How can I combine it with this condition or maybe there are some mechanism to run inspections one by one?
Please sign in to leave a comment.
Hi, its possible to create a custom inspection profile and run it through Analyze | Inspect Code https://www.jetbrains.com/help/idea/code-inspection.html
I think you didn't understand my question. I already have custom inspections according guide from your link.
How can I combine them in the chain like
if (checkFirstInspection) {if (checkSecondInspection) {
}
}
Hello?
I don't quite understand how you want to combine the two. If you want to find unannotated methods in unannotated classes, it should be possible to just combine the patterns into one:
WithAnnotationmin/max set to0andMethodset asThis variable is target of the search. I hope that helps.It's not solving my cases completely but it helped. Thank you!