Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322713

Summary: [5.0][clean up] Improve "Convert for loops to enhanced for loops" (code style)
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: deepakazad
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Markus Keller CLA 2010-08-14 18:41:18 EDT
I20100810-0800

From JUnitAddLibraryProposal#addToClasspath(..):

	IClasspathEntry[] oldEntries= project.getRawClasspath();
	for (int i= 0; i < oldEntries.length; i++) {
		IClasspathEntry curr= oldEntries[i];

... becomes:

	for (IClasspathEntry oldEntrie : oldEntries) {
		IClasspathEntry curr= oldEntrie;

1.) oldEntrie should be oldEntry (InternalNamingConventions#suggestVariableNames(..) converts to plural. We should convert to singular here. Implementation should probably go to JDT/Core).

2.) intermediate variable 'curr' is unnecessary

See also bug 214765.
Comment 1 Markus Keller CLA 2010-08-18 09:20:40 EDT
Another unnecessary parameter is in Resources#checkInSync(IResource[]).


A further problem is in NewTestCaseWizardPageTwo#getCheckedMethods():

	for (int i = 0; i < fCheckedObjects.length; i++) {
		if (fCheckedObjects[i] instanceof IMethod)

... becomes:

	for (Object fCheckedObject : fCheckedObjects) {
		if (fCheckedObject instanceof IMethod)

=> Code Style of org.eclipse.jdt.junit says that field prefix is 'f', so this should be removed from the generated variable name if necessary.
Comment 2 Eclipse Genie CLA 2019-05-06 08:51:24 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.