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.

Bug 60103 - Introduced variable is added in front of others declaration
Summary: Introduced variable is added in front of others declaration
Status: VERIFIED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 5.x
Hardware: PC Windows XP
: P3 blocker with 1 vote (vote)
Assignee: Jan Lahoda
URL:
Keywords:
: 60021 70208 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-06-16 09:37 UTC by Jiri Prox
Modified: 2007-06-18 12:30 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jiri Prox 2005-06-16 09:37:36 UTC
NB 4.2 (200506151800)
JDK 1.5.0_04

The introduced variable is added to the very begining of the appropriate method
in front of others local declarations but it can be dependent on then.

Example:

int i=1;
int b;

b=i+1;

introducing new variable lokalek from i+1 leads to this case:

int lokalek = i + i;
int i=1;
int b;

b=lokalek;

in the first line the variable i is not declared yet.
Comment 1 Jiri Prox 2005-06-16 09:50:43 UTC
The whole method:
public void method() {
        int i=1;
        int b;
        
        b=/*begin*/ i+1 /*end*/;        
    }

Selection marks by /*begin*/ and /*end*/

Result:
public void method() {
        int lokalek = i + 1; //here is error
        int i=1;
        int b;
        
        b=/*begin*/ lokalek /*end*/;        
    }
Comment 2 Daniel Prusa 2005-08-22 15:47:03 UTC
*** Issue 60021 has been marked as a duplicate of this issue. ***
Comment 3 Jan Becicka 2005-12-12 07:06:42 UTC
*** Issue 70208 has been marked as a duplicate of this issue. ***
Comment 4 Jesse Glick 2005-12-12 20:18:23 UTC
IMHO a P2: a compilable source file is converted to an uncompilable source file
by this transformation, with no warning; and not just in obscure border cases,
but usually.
Comment 5 Jan Becicka 2006-11-22 09:58:23 UTC
This functionality should be probably implemented differently - probably as a
hint (similar to surround with...)
Comment 6 Jan Becicka 2007-06-06 15:27:48 UTC
Anonymous to inner, Introduce variable and Extract method features are now (or
will be) implemented in java/hints module.
Comment 7 Jan Lahoda 2007-06-17 14:55:00 UTC
Should not happen with the new impl. of introduce variable.
Comment 8 Jiri Prox 2007-06-18 12:30:26 UTC
verified