diff --git a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/ConstructorCallSymbolProvider.java b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/ConstructorCallSymbolProvider.java index 1bf8cdb..2b016b1 100644 --- a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/ConstructorCallSymbolProvider.java +++ b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/ConstructorCallSymbolProvider.java @@ -6,24 +6,14 @@ import java.util.List; import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; import org.eclipse.jdt.core.IMethod; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodInvocation; import org.eclipse.jdt.core.search.MethodReferenceMatch; import org.eclipse.jdt.core.search.SearchMatch; import org.eclipse.jdt.internal.core.JavaElement; import org.eclipse.lsp4j.SymbolInformation; import org.eclipse.lsp4j.SymbolKind; -public class ConstructorCallSymbolProvider implements SymbolProvider, WithQuery { - public String query; - +public class ConstructorCallSymbolProvider implements SymbolProvider { @Override public List get(SearchMatch match) throws CoreException { List symbols = new ArrayList<>(); @@ -42,30 +32,11 @@ public List get(SearchMatch match) throws CoreException { } symbol.setContainerName(mod.getParent().getElementName()); symbol.setLocation(getLocation(mod, match)); - if (this.query.contains(".")) { - ICompilationUnit unit = mod.getCompilationUnit(); - ASTParser astParser = ASTParser.newParser(AST.getJLSLatest()); - astParser.setSource(unit); - astParser.setResolveBindings(true); - CompilationUnit cu = (CompilationUnit) astParser.createAST(null); - CustomASTVisitor visitor = new CustomASTVisitor(query, match); - cu.accept(visitor); - if (visitor.symbolMatches()) { - symbols.add(symbol); - } - } else { - symbols.add(symbol); - } + symbols.add(symbol); } catch (Exception e) { logInfo("unable to get constructor: " + e); return null; } return symbols; } - - @Override - public void setQuery(String query) { - // TODO Auto-generated method stub - this.query = query; - } } diff --git a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/CustomASTVisitor.java b/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/CustomASTVisitor.java deleted file mode 100644 index 7251e70..0000000 --- a/java-analyzer-bundle.core/src/main/java/io/konveyor/tackle/core/internal/symbol/CustomASTVisitor.java +++ /dev/null @@ -1,86 +0,0 @@ -package io.konveyor.tackle.core.internal.symbol; - -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodInvocation; -import org.eclipse.jdt.core.search.SearchMatch; - -import static org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin.logInfo; - -public class CustomASTVisitor extends ASTVisitor { - private String query; - private SearchMatch match; - private boolean symbolMatches; - - - public CustomASTVisitor(String query, SearchMatch match) { - /* - * When comparing query pattern with an actual java element's fqn - * we need to make sure that * not preceded with a . are replaced - * by .* so that java regex works as expected on them - */ - this.query = query.replaceAll("(? get(SearchMatch match) { symbol.setKind(convertSymbolKind(e)); symbol.setContainerName(e.getParent().getElementName()); symbol.setLocation(getLocation(e, match)); - if (this.query.contains(".")) { - ICompilationUnit unit = e.getCompilationUnit(); - ASTParser astParser = ASTParser.newParser(AST.getJLSLatest()); - astParser.setSource(unit); - astParser.setResolveBindings(true); - CompilationUnit cu = (CompilationUnit) astParser.createAST(null); - CustomASTVisitor visitor = new CustomASTVisitor(query, match); - cu.accept(visitor); - if (visitor.symbolMatches()) { - symbols.add(symbol); - } - } else { - symbols.add(symbol); - } + symbols.add(symbol); } catch (Exception e) { logInfo("unable to convert for variable: " + e); }