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 256986 - "Assign Return Value To New Value" applies "is*" handling to constructors
Summary: "Assign Return Value To New Value" applies "is*" handling to constructors
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.1
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-04 17:10 UTC by matthies
Modified: 2016-05-20 13:08 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Possible change (6.45 KB, patch)
2016-05-20 13:08 UTC, Svata Dedic
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description matthies 2015-12-04 17:10:59 UTC
Example:

    class Example
    {
        void example()
        {
            new Isdn();
        }
    }

    class Isdn { }

Applying "Assign Return Value To New Value" to "new Isdn()" results in:

    class Example
    {
        void example()
        {
            Isdn dn = new Isdn();
        }
    }

    class Isdn { }

The expected result would be to name the variable "isdn" instead of "dn". Handling "is" as a boolean prefix does not make sense for constructor invocations.
Comment 1 Svata Dedic 2016-05-20 13:01:51 UTC
The actual utility that tries to guess the name is in java.editor.
Comment 2 Svata Dedic 2016-05-20 13:08:09 UTC
Created attachment 159820 [details]
Possible change

I prepared a patch - it tries to use the Tree where the identifier came from for better decision.