Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 349782 - [quick assist] "Convert to enhanced for loop" isn't available for loops over array with prefix increment
Summary: [quick assist] "Convert to enhanced for loop" isn't available for loops over ...
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.8 M3   Edit
Assignee: Deepak Azad CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-06-20 01:33 EDT by Dmitry Matveev CLA
Modified: 2011-09-30 23:56 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 Dmitry Matveev CLA 2011-06-20 01:33:58 EDT
Build Identifier: M20110210-1200

    public static void main(String[] args)
    {
        for (int i = 0; i < args.length; ++i) { // "Convert to enhanced for loop" refactoring should be available on this line
            String arg = args[i];
            System.out.println(arg);
        }
        for (int i = 0; i < args.length; ++i) {
            String arg = args[i];
            System.out.println(arg);
        }
    }

Reproducible: Always

Steps to Reproduce:
1. Paste example function to some class.
2. Open suggestion window on for loop header (Ctrl-1).
3. Expected: "Convert to enhanced for loop" command is in list of suggestions, actual: It isn't.
Comment 1 Deepak Azad CLA 2011-06-20 01:44:55 EDT
Fix to go in org.eclipse.jdt.internal.corext.fix.ConvertForLoopOperation.validateUpdaters(ForStatement)
Comment 2 Deepak Azad CLA 2011-09-30 23:56:58 EDT
Fixed in HEAD. Commit - a5cb166bdf05e661f28b4234df6cdddde7912634