Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarified messaging of methodType checks in FindMissingTypes. #3808

Merged
merged 3 commits into from
Dec 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,10 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
} else if (!type.getName().equals(mi.getSimpleName()) && !type.isConstructor()) {
mi = SearchResult.found(mi, "type information has a different method name '" + type.getName() + "'");
}
if (mi.getName().getType() != null && type != mi.getName().getType()) {
mi = SearchResult.found(mi, "MethodInvocation#name type is not the MethodType of MethodInvocation.");
if (mi.getName().getType() != null && type != null && type != mi.getName().getType()) {
// The MethodDeclaration#name#type and the methodType field should be the same object.
// A different object in one implies a type has changed, either in the method signature or deeper in the type tree.
mi = SearchResult.found(mi, "MethodInvocation#name#type is not the same instance as the MethodType of MethodInvocation.");
}
}
return mi;
Expand Down Expand Up @@ -177,8 +179,10 @@ public J.MethodDeclaration visitMethodDeclaration(J.MethodDeclaration method, Ex
} else if (!md.getSimpleName().equals(type.getName()) && !type.isConstructor()) {
md = SearchResult.found(md, "type information has a different method name '" + type.getName() + "'");
}
if (md.getName().getType() != null && type != md.getName().getType()) {
md = SearchResult.found(md, "MethodDeclaration#name type is not the MethodType of MethodDeclaration.");
if (md.getName().getType() != null && type != null && type != md.getName().getType()) {
// The MethodDeclaration#name#type and the methodType field should be the same object.
// A different object in one implies a type has changed, either in the method signature or deeper in the type tree.
md = SearchResult.found(md, "MethodDeclaration#name#type is not the same instance as the MethodType of MethodDeclaration.");
}
return md;
}
Expand Down