-
Notifications
You must be signed in to change notification settings - Fork 13
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
🐛 check accuracy of TypeReferenceMatch & MethodReferenceMatch #91
Conversation
Signed-off-by: Pranav Gaikwad <[email protected]> :update: Signed-off-by: Pranav Gaikwad <[email protected]>
Signed-off-by: Pranav Gaikwad <[email protected]>
var element = (IJavaElement) match.getElement(); | ||
ICompilationUnit compilationUnit = (ICompilationUnit) element | ||
.getAncestor(IJavaElement.COMPILATION_UNIT); | ||
if (compilationUnit == null) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my own understanding when does this happen?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understood it correctly, this happens when match is in a .class file. In that case, the compilation unit needs to be loaded into memory. Fortunately, the class file doesn't need to be decompiled....we can somehow get imports, package declaration, methods etc just from the class file handle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes a ton of sense and is probably a much better approach to calculating accuracy.
I wonder if we are going to have to something similar for Annotations, IIRC that is the only one that was causing issues
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Signed-off-by: Pranav Gaikwad <[email protected]>
I will do a similar thing for annotations too when I get the time, this addresses most of the test failures. I will get back to it after I am done with testing stuff. tracking it here #92 |
This removes accuracy checks that depend on errors in the project.
I observed that most inaccurate matches we get are from TypeReferenceMatch matches, this is because they do not take into account fully qualified names of types.
There is also some instances of inaccurate stuff coming from method calls, this fixes the search pattern to be fully qualified instead of all references.