Bug 28869 Parse error with final local vars without immediate assignment
Consider this prototype code: void foo() { final PreparedStatement statement; try { statement = xxx.prepareStatement(...) } catch (..) { // handle errors } return statement; } For this kind of thing I often use a final local variable - mostly to enable the compiler to find my errors (like assigning more than once). However, with Eclipse I get parse errors (cursor on the line that declares the local var) when using refactoring functions, such as "Reorganize imports". The Eclipse version used is Eclipse 2.1 M4.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
OrganizeImportsOperation op= new OrganizeImportsOperation(cu, prefOrder, threshold, ignoreLowerCaseNames, !cu.isWorkingCopy(), doResolve, createChooseImportQuery());
		
			BusyIndicatorRunnableContext context= new BusyIndicatorRunnableContext();
			context.run(false, true, new WorkbenchRunnableAdapter(op));
			ISourceRange errorRange= op.getErrorSourceRange();
			if (errorRange != null) {
				MessageDialog.openInformation(getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.single.error.parse")); 
				if (fEditor != null) {
					fEditor.selectAndReveal(errorRange.getOffset(), errorRange.getLength());
				}
			} else {
				if (fEditor != null) {
					setStatusBarMessage(getOrganizeInfo(op));
				}
			}
		} catch (CoreException e) {	
			ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message")); 
		} catch (InvocationTargetException e) {
			ExceptionHandler.handle(e, getShell(), ActionMessages.getString("OrganizeImportsAction.error.title"), ActionMessages.getString("OrganizeImportsAction.error.message")); 
		} catch (InterruptedException e) {
		}
	}
	
	private String getOrganizeInfo(OrganizeImportsOperation op) {
		int nImportsAdded= op.getNumberOfImportsAdded();
		if (nImportsAdded >= 0) {
			return ActionMessages.getFormattedString("OrganizeImportsAction.summary_added", String.valueOf(nImportsAdded)); 
		} else {
			return ActionMessages.getFormattedString("OrganizeImportsAction.summary_removed", String.valueOf(-nImportsAdded)); 
		}