Bug 29375 Search for reference gives strange results when references are in static initialisers [search]
[M4] When references to a class or method are in the static initialiser for a class (which is also in a package other than the default one) the results contain spurious nulls. Test case: package foo.bar; public class Test { static { new Test().toString(); } } Highlight "Test" (either place) and search for references in the workspace. The result will be: nullnullbar.Test.{...}
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/JavaElementLabels.java
if (segements > 0 && !varNamePrepended) {
				buf.append(path.segment(segements - 1));
				if (segements > 1 || path.getDevice() != null) {
					buf.append(CONCAT_STRING);
					buf.append(path.removeLastSegments(1).toOSString());
				}
			} else {
				buf.append(path.toOSString());
			}
		} else {
			if (getFlag(flags, ROOT_QUALIFIED)) {
				buf.append(root.getPath().makeRelative().toString());
			} else {
				buf.append(root.getElementName());
			}
			if (getFlag(flags, ROOT_POST_QUALIFIED)) {
				buf.append(CONCAT_STRING);
				buf.append(root.getParent().getElementName());
			}
		}		
	}	
	private static void refreshPackageNamePattern() {
		String pattern= getPkgNamePatternForPackagesView();
		if (pattern.equals(fgPkgNamePattern))
			return;
		else if (pattern.equals("")) { 
			fgPkgNamePattern= ""; 
			fgPkgNameLength= -1;
			return;
		}