Skip to content

Commit

Permalink
Filtering unqualified Stacktraces #115
Browse files Browse the repository at this point in the history
Using method signature to filter unqualified stacktraces generated from
java stacktrace console.

Fixes #115
  • Loading branch information
SougandhS committed Nov 6, 2024
1 parent 0f2ebc7 commit be2ed34
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 80 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,11 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
processSearchResult(exactMatchesFiltered.get(0), typeName, lineNumber);
return Status.OK_STATUS;
}
List<Object> filteredResults = filterBinResults(exactMatchesFiltered);
if (filteredResults.size() == 1) {
processSearchResult(filteredResults.get(0), typeName, lineNumber);
if (exactMatchesFiltered.size() == 1) {
processSearchResult(exactMatchesFiltered.get(0), typeName, lineNumber);
return Status.OK_STATUS;
}
return openClipboard(filteredResults, line, typeName);
return openClipboard(exactMatchesFiltered, line, typeName);

}
return openClipboard(matches, line, typeName);
Expand All @@ -239,40 +238,6 @@ public IStatus runInUIThread(IProgressMonitor monitor) {
job.schedule();
}

/**
* Further filters the extracted results
*
* @param exactMatchesFiltered
* extracted matches method name
* @return returns <code>List</code>
*/
private List<Object> filterBinResults(List<Object> exactMatchesFiltered) {
List<Object> itemsToBeDeleted = new ArrayList<>();
List<Object> fileredResults = new ArrayList<>();
for (Object res : exactMatchesFiltered) {
if (res instanceof IType type) {
if (type.getFullyQualifiedName().startsWith("bin.")) { //$NON-NLS-1$
String currentTarget = type.getFullyQualifiedName().substring(4);
long counts = exactMatchesFiltered.stream().filter(obj -> obj instanceof IType).map(obj -> (IType) obj).filter(ob -> {
String current = ob.getFullyQualifiedName();
if (current.startsWith("bin.")) { //$NON-NLS-1$
current = current.substring(4);
}
return current.equals(currentTarget);
}).count();
if (counts > 1) {
itemsToBeDeleted.add(res);
}
}
}
}
for (Object obj : exactMatchesFiltered) {
if (!itemsToBeDeleted.contains(obj)) {
fileredResults.add(obj);
}
}
return fileredResults;
}
/**
* Filter classes based on matching method name
*
Expand Down

0 comments on commit be2ed34

Please sign in to comment.