This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | "Create local variable" creates variable at wrong location | ||
---|---|---|---|
Product: | java | Reporter: | rcasha <rcasha> |
Component: | Hints | Assignee: | Svata Dedic <sdedic> |
Status: | NEW --- | ||
Severity: | normal | CC: | matthies |
Priority: | P3 | ||
Version: | 7.0 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
rcasha
2011-02-08 07:26:42 UTC
I agree, and to be more precise, the variable should not be added at the start of the block, but at the latest possible position within the relevant block. For example in void foo() { // ... some code not using 'temp'... for (x : list) { // ... more code not using 'temp'... // (*) do { // ... more code ... if (temp > 0) { // ... even more code ... temp = temp - delta; } } while (temp >= 0); // ... more code possibly using 'temp'... } // ... more code not using 'temp'... } the variable declaration should be created at (*). |