-
Notifications
You must be signed in to change notification settings - Fork 20
🐛 Improve method matching to catch static methods declared on class fields #150
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
Conversation
WalkthroughUpdates MethodCallSymbolProvider to treat matched elements as generic IJavaElement, adding IField handling, null-safe compilation unit resolution (including CLASS_FILE ancestor fallback), and preserving existing behavior for non-qualified queries. Imports adjusted accordingly and unit disposal retained. Changes
Sequence Diagram(s)sequenceDiagram
participant Provider as MethodCallSymbolProvider
participant Matcher as Search/Match
participant Element as IJavaElement
participant JDT as JDT (CU/Ancestor)
Provider->>Matcher: get match element
Matcher-->>Provider: element (IJavaElement)
alt element is IMethod
Provider->>Element: getCompilationUnit()
Element-->>Provider: unit (maybe null)
else element is IField
Provider->>Element: getCompilationUnit()
Element-->>Provider: unit (maybe null)
else other element
Note right of Provider: unit = null
end
alt unit is null
Provider->>JDT: element.getAncestor(CLASS_FILE)
JDT-->>Provider: classFile (maybe null)
Provider->>JDT: classFile.getWorkingCopy()/getCU
JDT-->>Provider: unit (maybe null)
end
Provider->>Provider: process query (unchanged for non-qualified)
Provider-->>JDT: discard/close unit
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (3)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Is there a test case that shows an example of what this catches now vs what was missing? |
shawn-hurley
left a comment
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.
I think that this looks good, and is a good change. I would like to request a follow-up that includes a test to ensure we don't inadvertently break this fix.
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]> # Conflicts: # java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java
Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
…ields (#150) * Improve method matching to catch static methods declared on class fields Signed-off-by: Juan Manuel Leflet Estrada <[email protected]> # Conflicts: # java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java * Remove unnecessary line Signed-off-by: Juan Manuel Leflet Estrada <[email protected]> --------- Signed-off-by: Juan Manuel Leflet Estrada <[email protected]> Signed-off-by: Cherry Picker <[email protected]>
…ields (#150) (#156) * Improve method matching to catch static methods declared on class fields # Conflicts: # java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java * Remove unnecessary line --------- Signed-off-by: Juan Manuel Leflet Estrada <[email protected]> Signed-off-by: Cherry Picker <[email protected]> Co-authored-by: Juan Manuel Leflet Estrada <[email protected]>
Related to https://issues.redhat.com/browse/MTA-5763
Summary by CodeRabbit