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 240912 - Rename of implicit typed lambda argument does not work if it hides a local member
Summary: Rename of implicit typed lambda argument does not work if it hides a local me...
Status: RESOLVED FIXED
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 8.0
Hardware: PC All
: P2 normal (vote)
Assignee: Svata Dedic
URL:
Keywords: JDK_8
: 241502 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-01-24 07:07 UTC by brettryan
Modified: 2014-02-14 02:55 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 brettryan 2014-01-24 07:07:26 UTC
Rename of a lambda argument can successfully be renamed by CTRL+R except for if that lambda argument hides a member variable or is implicitly typed.

Given the following example:

    private boolean o1;
    private void bogie() {
        Collections.<String>sort(Collections.<String>emptyList(), (o1, o2) -> {
            return o1.length() - o2.length();
        });
    }

Netbeans will inform that "Local variable hides a field". Executing action "Rename Local Variable" OR placing the cursor on `o1' in the lambda argument and hitting CTRL+R will not do anything. Placing on `o1' in the lambda body will incorrectly rename the member variable name, not the argument list name.

Note that o2 can be renamed quite fine.

If the lambda arguments are explicitly typed the rename works correctly:

    private boolean o1;
    private void bogie() {
        Collections.<String>sort(Collections.<String>emptyList(), (String o1, String o2) -> {
            return o1.length() - o2.length();
        });
    }
Comment 1 Ralph Ruijs 2014-02-03 09:41:52 UTC
Highlighting is not working correctly in this case as well. I think this should be fixed in java/source, but please reassign if this is not the right component.
Comment 2 Svata Dedic 2014-02-05 16:04:25 UTC
Fixed in jet-main#3fa549217d1a
Comment 3 Ralph Ruijs 2014-02-06 19:37:12 UTC
*** Bug 241502 has been marked as a duplicate of this bug. ***
Comment 4 Quality Engineering 2014-02-14 02:55:18 UTC
Integrated into 'main-silver', will be available in build *201402140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/3fa549217d1a
User: Svata Dedic <sdedic@netbeans.org>
Log: #240912: support highlight of lambda implicit params