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 145943 - Variable name "aNull" is generated for "isNull" method by "Assign Return Value To New Variable"
Summary: Variable name "aNull" is generated for "isNull" method by "Assign Return Valu...
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P4 blocker (vote)
Assignee: Max Sauer
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-02 16:06 UTC by matthies
Modified: 2009-11-02 10:55 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 matthies 2008-09-02 16:06:17 UTC
Test case:

    class Test
    {
        interface Datatype<T>
        {
            boolean isNull(T value);
        }

        public static void main(String[] args)
        {
            Datatype<String> datatype = null;
            datatype.isNull("");
        }
    }

Perform "Assign Return Value To New Variable" on 'datatype.isNull("");'. The result is:

            boolean aNull = datatype.isNull("");

Expected result was:

            boolean isNull = datatype.isNull("");

Product Version: NetBeans IDE 6.1 (Build 200804211638)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)
Comment 1 Jiri Prox 2008-09-03 08:58:12 UTC
Not so serious IMHO.
Just a little explanation - the name of variable derived by removing is/get for getter methods. Is the result is a
keyword a prefix 'a' is added.
Comment 2 matthies 2008-09-03 13:28:11 UTC
Yes, I guessed so much. But normally no prefix 'a' is added. It is only added when the result would match a Java 
keyword and hence wouldn't be a valid identifier. The defect is that adding 'a' assumes that the removed prefix 
was 'get'. At least in the case of 'is', it begs the question why the 'is' was removed in the first place when a new 
prefix has to be added anyway. Possible solutions:

1) Make the fallback prefix dependent on the removed prefix.
2) Don't remove the getter prefix in the first place if the result is a Java keyword.
3) Use the normal name collision logic which appends a number (e.g. "null1").
Comment 3 Max Sauer 2008-11-25 14:50:40 UTC
This will be resolved LATER.
Comment 4 Quality Engineering 2009-11-02 10:55:48 UTC
NetBeans.org Migration: changing resolution from LATER to WONTFIX