Source:
<code>public void run(IAction action) { <START> ArrayList<IJavaElement> allCus = new ArrayList<>(); <END> try { for (Iterator<IJavaElement> it = selection.iterator(); it.hasNext();) { Object element = it.next(); if (element instanceof IJavaElement) collectCompilationUnits((IJavaElement) element, allCus); } } catch (JavaModelException e) { ErrorDialog.openError(part.getSite().getShell(), "Find Unused Members", "Problem collecting compilation units", e.getStatus()); return; } if (allCus.isEmpty()) { MessageDialog.openInformation(part.getSite().getShell(), "Find Unused Members", "No compilation units in 'internal' packages selected"); return; } ICompilationUnit[] cus = allCus.toArray(new ICompilationUnit[allCus.size()]); if (SHOW_RESULTS_IN_SEARCH_VIEW) { NewSearchUI.runQueryInBackground(new FindUnusedSearchQuery(cus)); return; } FileDialog dialog = new FileDialog(part.getSite().getShell(), SWT.SAVE); String outFileName = dialog.open(); if (outFileName == null) return; File outputFile = new File(outFileName); if (outputFile.exists()) outputFile.delete(); FileWriter writer = null; try { int unusedCount = 0; try { writer = new FileWriter(outputFile); FindUnusedMembers search = new FindUnusedMembers(cus, writer); PlatformUI.getWorkbench().getProgressService().run(true, true, search); unusedCount = search.getUnusedMethodCount(); } finally { String summary = "Search complete. Found " + unusedCount + " unreferenced methods."; if (writer != null) { writer.write("\n\n"); writer.write(summary); writer.close(); } MessageDialog.openInformation(part.getSite().getShell(), "Search Complete", summary); } } catch (Exception e) { e.printStackTrace(); } }</code><technical_language>Collection List interface instead of concrete type ArrayList</technical_language>

Target:
public void run(IAction action) { List<IJavaElement> allCus = new ArrayList<>(); try { for (Iterator<?> it = selection.iterator(); it.hasNext();) { Object element = it.next(); if (element instanceof IJavaElement) collectCompilationUnits((IJavaElement) element, allCus); } } catch (JavaModelException e) { ErrorDialog.openError(part.getSite().getShell(), "Find Unused Members", "Problem collecting compilation units", e.getStatus()); return; } if (allCus.isEmpty()) { MessageDialog.openInformation(part.getSite().getShell(), "Find Unused Members", "No compilation units in 'internal' packages selected"); return; } ICompilationUnit[] cus = allCus.toArray(new ICompilationUnit[allCus.size()]); if (SHOW_RESULTS_IN_SEARCH_VIEW) { NewSearchUI.runQueryInBackground(new FindUnusedSearchQuery(cus)); return; } FileDialog dialog = new FileDialog(part.getSite().getShell(), SWT.SAVE); String outFileName = dialog.open(); if (outFileName == null) return; File outputFile = new File(outFileName); if (outputFile.exists()) outputFile.delete(); FileWriter writer = null; try { int unusedCount = 0; try { writer = new FileWriter(outputFile); FindUnusedMembers search = new FindUnusedMembers(cus, writer); PlatformUI.getWorkbench().getProgressService().run(true, true, search); unusedCount = search.getUnusedMethodCount(); } finally { String summary = "Search complete. Found " + unusedCount + " unreferenced methods."; if (writer != null) { writer.write("\n\n"); writer.write(summary); writer.close(); } MessageDialog.openInformation(part.getSite().getShell(), "Search Complete", summary); } } catch (Exception e) { e.printStackTrace(); } }