Bug 22260 Internal Error during creation of class using New Class Wizard [code manipulation]
When trying to create the class "URLs" by means of New Class Wizard I get the error "Invalid Contents specified.". Source file is created with only package statement. So far I've figured out that it happens if second letter of the class is uppercased. After that Error Log contains the Internal Error: Java Model Exception: Java Model Status [Invalid contents specified.] at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:307) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:513) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1361) at org.eclipse.jdt.internal.core.JavaModelManager.runOperation (JavaModelManager.java:1212) at org.eclipse.jdt.internal.core.JavaElement.runOperation (JavaElement.java:574) at org.eclipse.jdt.internal.core.CompilationUnit.createType (CompilationUnit.java:203) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType (NewTypeWizardPage.java:1335) at org.eclipse.jdt.ui.wizards.NewTypeWizardPage$1.run (NewTypeWizardPage.java:1637) at org.eclipse.ui.actions.WorkspaceModifyDelegatingOperation.execute (WorkspaceModifyDelegatingOperation.java:39) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run (WorkspaceModifyOperation.java:64) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1361) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:78) at org.eclipse.jface.operation.ModalContext.runInCurrentThread (ModalContext.java:299) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:249) at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:720) at org.eclipse.jdt.internal.ui.wizards.NewElementWizard.finishPage (NewElementWizard.java:66) at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.performFinish (NewClassCreationWizard.java:42) at org.eclipse.jface.wizard.WizardDialog.finishPressed (WizardDialog.java:577) at org.eclipse.jface.wizard.WizardDialog.buttonPressed (WizardDialog.java:312) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:398) at org.eclipse.swt.widgets.TypedListener.handleEvent (TypedListener.java:87) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.jface.window.Window.runEventLoop(Window.java:557) at org.eclipse.jface.window.Window.open(Window.java:537) at org.eclipse.ui.internal.NewWizardShortcutAction.run (NewWizardShortcutAction.java:88) at org.eclipse.jface.action.Action.runWithEvent(Action.java:749) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection (ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent (ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0 (ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent (ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:827) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1529) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1291) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1177) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1160) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:248) at org.eclipse.core.launcher.Main.run(Main.java:698) at org.eclipse.core.launcher.Main.main(Main.java:534)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
* @param doConstructors if <code>true</code> unimplemented constructors are created
	 * @param doUnimplementedMethods if <code>true</code> unimplemented methods are created
	 * @param imports an import manager to add all neded import statements
	 * @param monitor a progress monitor to report progress
	 */
	protected IMethod[] createInheritedMethods(IType type, boolean doConstructors, boolean doUnimplementedMethods, ImportsManager imports, IProgressMonitor monitor) throws CoreException {
		ArrayList newMethods= new ArrayList();
		ITypeHierarchy hierarchy= type.newSupertypeHierarchy(monitor);
		CodeGenerationSettings settings= JavaPreferencesSettings.getCodeGenerationSettings();
		if (doConstructors) {
			IType superclass= hierarchy.getSuperclass(type);
			if (superclass != null) {
				String[] constructors= StubUtility.evalConstructors(type, superclass, settings, imports.getImportsStructure());
				if (constructors != null) {
					for (int i= 0; i < constructors.length; i++) {
						newMethods.add(constructors[i]);
					}
				}
			
			}
		}
		if (doUnimplementedMethods) {
			String[] unimplemented= StubUtility.evalUnimplementedMethods(type, hierarchy, false, settings, null, imports.getImportsStructure());
			if (unimplemented != null) {
				for (int i= 0; i < unimplemented.length; i++) {
					newMethods.add(unimplemented[i]);					
				}
			}
		}
		IMethod[] createdMethods= new IMethod[newMethods.size()];