Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 322713 - [5.0][clean up] Improve "Convert for loops to enhanced for loops" (code style)
Summary: [5.0][clean up] Improve "Convert for loops to enhanced for loops" (code style)
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2010-08-14 18:41 EDT by Markus Keller CLA
Modified: 2019-05-06 08:51 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.