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 240453 - Rename variable allowed to infrignate on scope
Summary: Rename variable allowed to infrignate on scope
Status: RESOLVED DUPLICATE of bug 215138
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.0
Hardware: PC All
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-14 14:38 UTC by Chiana
Modified: 2014-01-21 10:33 UTC (History)
0 users

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 Chiana 2014-01-14 14:38:50 UTC
[ JDK VERSION : 1.7.0_45 ]

When you rename a variable it is allowed to hide a variable with a larger
scope.
This is not desirable as it can introduce some WERY hard to track errors.

Example;
class Test {
  InputStream input

  Test() {
    InputStream in;
    input=GlobalConnectionBoxHandler.getInputStream();
    in=null;
  }
}

If you in this case (only an example) rename the "in" to "input" it would
destroy the content of "input".

As there is not even a warning I do consider this a BUG rather than an
ENHANCEMENT.
Comment 1 Ralph Ruijs 2014-01-21 10:33:09 UTC
The inline rename in a java-editor is not able to perform these kind of checks. The full rename refactoring already catches these cases. Marking as a duplicate f #215138, as this bug tracks the progress of merging the two.

*** This bug has been marked as a duplicate of bug 215138 ***