Skip to content

Commit a072cb0

Browse files
authored
Revert ":bug: Improve method matching to catch static methods declared on cla…" (#148)
This reverts commit 8f942d2. Signed-off-by: Juan Manuel Leflet Estrada <[email protected]>
1 parent b387834 commit a072cb0

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/SampleDelegateCommandHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private static List<SymbolInformation> search(String projectName, ArrayList<Stri
203203
logInfo("Searching in target project: " + targetProjects);
204204

205205
// For Partial results, we are going to filter out based on a list in the engine
206-
int s = IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS | IJavaSearchScope.APPLICATION_LIBRARIES | IJavaSearchScope.SYSTEM_LIBRARIES;
206+
int s = IJavaSearchScope.SOURCES | IJavaSearchScope.REFERENCED_PROJECTS | IJavaSearchScope.APPLICATION_LIBRARIES;
207207
if (analysisMode.equals(sourceOnlyAnalysisMode)) {
208208
logInfo("KONVEYOR_LOG: source-only analysis mode only scoping to Sources");
209209
s = IJavaSearchScope.SOURCES;
@@ -227,7 +227,7 @@ private static List<SymbolInformation> search(String projectName, ArrayList<Stri
227227
logInfo("unable to find workspace directory location");
228228
return new ArrayList<>();
229229
}
230-
230+
231231
if (includedPaths != null && includedPaths.size() > 0) {
232232
ArrayList<IJavaElement> includedFragments = new ArrayList<IJavaElement>();
233233
for (IJavaProject proj : targetProjects) {

java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/MethodCallSymbolProvider.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
import org.eclipse.jdt.core.IClassFile;
99
import org.eclipse.jdt.core.ICompilationUnit;
10-
import org.eclipse.jdt.core.IField;
1110
import org.eclipse.jdt.core.IJavaElement;
1211
import org.eclipse.jdt.core.IMethod;
12+
import org.eclipse.jdt.core.ITypeRoot;
1313
import org.eclipse.jdt.core.compiler.IProblem;
1414
import org.eclipse.jdt.core.dom.AST;
1515
import org.eclipse.jdt.core.dom.ASTParser;
@@ -32,21 +32,15 @@ public List<SymbolInformation> get(SearchMatch match) {
3232
// For Method Calls we will need to do the local variable trick
3333
try {
3434
MethodReferenceMatch m = (MethodReferenceMatch) match;
35-
IJavaElement e = (IJavaElement) m.getElement();
35+
IMethod e = (IMethod) m.getElement();
3636
SymbolInformation symbol = new SymbolInformation();
3737
Location location = getLocation((IJavaElement) match.getElement(), match);
3838
symbol.setName(e.getElementName());
3939
symbol.setKind(convertSymbolKind(e));
4040
symbol.setContainerName(e.getParent().getElementName());
4141
symbol.setLocation(location);
4242
if (this.query.contains(".")) {
43-
ICompilationUnit unit = null;
44-
if (m.getElement() instanceof IMethod) {
45-
unit = ((IMethod) m.getElement()).getCompilationUnit();
46-
} else if (m.getElement() instanceof IField) {
47-
unit = ((IField) m.getElement()).getCompilationUnit();
48-
}
49-
43+
ICompilationUnit unit = e.getCompilationUnit();
5044
if (unit == null) {
5145
IClassFile cls = (IClassFile) ((IJavaElement) e).getAncestor(IJavaElement.CLASS_FILE);
5246
if (cls != null) {

0 commit comments

Comments
 (0)