SSR: better matching for comments on Java methods (IJPL-149678)

GitOrigin-RevId: e66768fcb9adbf0fd7ca0be950d4da41373a918d
This commit is contained in:
Bas Leijdekkers
2024-06-10 17:19:34 +02:00
committed by intellij-monorepo-bot
parent 816d61b8bf
commit 66ad661ec7
2 changed files with 40 additions and 7 deletions

View File

@@ -1829,15 +1829,17 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
context.pushResult();
try {
final PsiDocComment docComment = method.getDocComment();
if (docComment != null && !myMatchingVisitor.setResult(myMatchingVisitor.match(docComment, other.getDocComment()))) return;
if (method.hasTypeParameters() && !myMatchingVisitor.setResult(
myMatchingVisitor.match(method.getTypeParameterList(), other.getTypeParameterList()))) return;
final PsiElement docComment = method.getFirstChild();
if (docComment instanceof PsiComment && !myMatchingVisitor.setResult(myMatchingVisitor.match(docComment, other.getFirstChild()))) {
return;
}
if (method.hasTypeParameters() &&
!myMatchingVisitor.setResult(myMatchingVisitor.match(method.getTypeParameterList(), other.getTypeParameterList()))) {
return;
}
if (!myMatchingVisitor.setResult(checkHierarchy(other, method))) {
return;
}
if (!myMatchingVisitor.setResult((!method.isConstructor() || other.isConstructor()) &&
(isTypedVar || myMatchingVisitor.matchText(methodNameNode, other.getNameIdentifier())) &&
myMatchingVisitor.match(method.getModifierList(), other.getModifierList()))) {