Bug 581072 - Java postfix template "fori" and "forr" contain hardcoded variable name
Summary: Java postfix template "fori" and "forr" contain hardcoded variable name
Status: RESOLVED FIXED
Alias: None
Product: Incubator
Classification: Eclipse Project
Component: e4 (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: E4 Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: ui, usability
Depends on:
Blocks:
 
Reported: 2022-11-18 09:52 EST by C E CLA
Modified: 2022-11-18 11:59 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description C E CLA 2022-11-18 09:52:12 EST
The current code assist template "fori" reads as:

// Currently:
for (int ${index} = 0; i < ${i:inner_expression(array)}.length; ${index}++) {
	${cursor}
}


The hardcoded "i" in the loop condition should be parametrized like it is in pre-/post-loop statements with ${index} like this:

// Should be:
for (int ${index} = 0; ${index} < ${i:inner_expression(array)}.length; ${index}++) {
	${cursor}
}

A similar bug exists in the "forr" template:

// Currently:
for (int ${index} = ${i:inner_expression(array)}.length - 1; i >= 0; ${index}--) {
	${cursor}
}

// Should be:
for (int ${index} = ${i:inner_expression(array)}.length - 1; ${index} >= 0; ${index}--) {
	${cursor}
}
Comment 1 C E CLA 2022-11-18 10:56:21 EST
Related: https://github.com/eclipse-jdt/eclipse.jdt.ui/pull/300

Seems like it's already fixed for the upcoming release?