Bug 57036 New Search shows annotations in internal jar (for matches in class file)
3.0 M8 - import org.junit as binary plug-in project - search for references to type "TestListener" - select the library junit.jar - from context menu, choose Open With > Text Editor -> invalid "matches" are shown in the editor Problem is probably in JavaSearchResult#getFile(Object), which should not getUnderlyingResource() for JavaElements not in a ICompilationUnit.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchResult.java
public IFile getFile(Object element) {
		if (element instanceof IJavaElement) {
			IJavaElement javaElement= (IJavaElement) element;
			try {
				element= javaElement.getUnderlyingResource();
			} catch (JavaModelException e) {
				
			}
		}
		if (element instanceof IFile)
			return (IFile)element;
		return null;
	}
	/* (non-Javadoc)
	 * @see org.eclipse.search2.ui.text.IStructureProvider#isShownInEditor(org.eclipse.search2.ui.text.Match, org.eclipse.ui.IEditorPart)
	 */
	public boolean isShownInEditor(Match match, IEditorPart editor) {
		IEditorInput editorInput= editor.getEditorInput();
		if (match.getElement() instanceof IJavaElement) {
			IJavaElement je= (IJavaElement) match.getElement();
			if (editorInput instanceof IFileEditorInput) {
				IFile inputFile= ((IFileEditorInput)editorInput).getFile();
				IResource matchFile= null;
				ICompilationUnit cu= (ICompilationUnit) je.getAncestor(IJavaElement.COMPILATION_UNIT);
				if (cu != null) {
					matchFile= cu.getResource();
				} else {
					IClassFile cf= (IClassFile) je.getAncestor(IJavaElement.CLASS_FILE);
					if (cf != null)
						matchFile= cf.getResource();