From ad59c0fd3208004250585c7fca4d32d64231bc3b Mon Sep 17 00:00:00 2001 From: Juan Manuel Leflet Estrada Date: Tue, 23 Sep 2025 13:23:51 +0200 Subject: [PATCH] =?UTF-8?q?Revert=20":bug:=20Improve=20method=20matching?= =?UTF-8?q?=20to=20catch=20static=20methods=20declared=20on=20cla=E2=80=A6?= =?UTF-8?q?"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8f942d2b94494bccc47a69f8b01824739be02315. Signed-off-by: Juan Manuel Leflet Estrada --- .../core/internal/SampleDelegateCommandHandler.java | 4 ++-- .../internal/symbol/MethodCallSymbolProvider.java | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java index 36fa210..6c61911 100644 --- a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java +++ b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java @@ -203,7 +203,7 @@ private static List search(String projectName, ArrayList search(String projectName, ArrayList(); } - + if (includedPaths != null && includedPaths.size() > 0) { ArrayList includedFragments = new ArrayList(); for (IJavaProject proj : targetProjects) { diff --git a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java index 257554d..5e7f10b 100644 --- a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java +++ b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java @@ -7,9 +7,9 @@ import org.eclipse.jdt.core.IClassFile; import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IField; import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMethod; +import org.eclipse.jdt.core.ITypeRoot; import org.eclipse.jdt.core.compiler.IProblem; import org.eclipse.jdt.core.dom.AST; import org.eclipse.jdt.core.dom.ASTParser; @@ -32,7 +32,7 @@ public List get(SearchMatch match) { // For Method Calls we will need to do the local variable trick try { MethodReferenceMatch m = (MethodReferenceMatch) match; - IJavaElement e = (IJavaElement) m.getElement(); + IMethod e = (IMethod) m.getElement(); SymbolInformation symbol = new SymbolInformation(); Location location = getLocation((IJavaElement) match.getElement(), match); symbol.setName(e.getElementName()); @@ -40,13 +40,7 @@ public List get(SearchMatch match) { symbol.setContainerName(e.getParent().getElementName()); symbol.setLocation(location); if (this.query.contains(".")) { - ICompilationUnit unit = null; - if (m.getElement() instanceof IMethod) { - unit = ((IMethod) m.getElement()).getCompilationUnit(); - } else if (m.getElement() instanceof IField) { - unit = ((IField) m.getElement()).getCompilationUnit(); - } - + ICompilationUnit unit = e.getCompilationUnit(); if (unit == null) { IClassFile cls = (IClassFile) ((IJavaElement) e).getAncestor(IJavaElement.CLASS_FILE); if (cls != null) {