Bug 6051 IllegalArgumentException in Initializer constructor
Build 20011115 Trying to browse the (newly added) static initializer of JavaModelManager: Log: Mon Nov 19 12:20:19 CET 2001 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Unhandled exception caught in event loop. Reason: Log: Mon Nov 19 12:20:19 CET 2001 4 org.eclipse.ui 0 java.lang.IllegalArgumentException java.lang.IllegalArgumentException at org.eclipse.jdt.internal.core.Initializer.<init>(Initializer.java:24) at org.eclipse.jdt.internal.core.SourceType.getInitializer(SourceType.ja va:132) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findMemberInCompilatio nUnit(JavaModelUtil.java:161) at org.eclipse.jdt.internal.ui.util.JavaModelUtil.findInCompilationUnit( JavaModelUtil.java:208) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.getWorkingCopy(E ditorUtility.java:272) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getCorre spondingElement(CompilationUnitEditor.java:525) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.setSelection(JavaEd itor.java:257) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor(E ditorUtility.java:110) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.linkToEdi tor(PackageExplorerPart.java:762) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.handleSel ectionChanged(PackageExplorerPart.java:691) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart.access$0( PackageExplorerPart.java:687) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$3.selecti onChanged(PackageExplorerPart.java:317) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged(Viewer.java:147 ) at org.eclipse.jface.viewers.StructuredViewer.updateSelection(Structured Viewer.java:907) at org.eclipse.jface.viewers.StructuredViewer.handleSelect(StructuredVie wer.java:463) at org.eclipse.jface.viewers.AbstractTreeViewer$1.widgetSelected(Abstrac tTreeViewer.java:624) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java: 85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:54) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:635) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1365) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1167) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:729) at org.eclipse.ui.internal.Workbench.run(Workbench.java:712) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoa der.java:820) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:285) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:151) at org.eclipse.core.launcher.Main.run(Main.java:502) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) java.lang.IllegalArgumentException
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/util/JavaModelUtil.java
return null;
	}
	
	/** 
	 * Finds a a member in a compilation unit. Typical usage is to find the corresponding
	 * member in a working copy.
	 * @param cu the compilation unit (eg. working copy) to search in
	 * @param member the member (eg. from the original)
	 * @return the member found, or null if not existing
	 */		
	public static IMember findMemberInCompilationUnit(ICompilationUnit cu, IMember member) throws JavaModelException {
		if (member.getElementType() == IJavaElement.TYPE) {
			return findTypeInCompilationUnit(cu, getTypeQualifiedName((IType)member));
		} else {
			IType declaringType= findTypeInCompilationUnit(cu, getTypeQualifiedName(member.getDeclaringType()));
			if (declaringType != null) {
				IMember result= null;
				switch (member.getElementType()) {
				case IJavaElement.FIELD:
					result= declaringType.getField(member.getElementName());
					break;
				case IJavaElement.METHOD:
					IMethod meth= (IMethod) member;
					result= findMethod(meth.getElementName(), meth.getParameterTypes(), meth.isConstructor(), declaringType);
					break;
				case IJavaElement.INITIALIZER:
					result= declaringType.getInitializer(0);
					break;					
				}
				if (result != null && result.exists()) {