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

Summary: "Assign Return Value To New Value" applies "is*" handling to constructors
Product: java Reporter: matthies <matthies>
Component: EditorAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal CC: sdedic
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: Possible change

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.