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 252138

Summary: Strange tooltip values for null members during debugging
Product: debugger Reporter: cezariusz <cezariusz>
Component: JavaAssignee: Martin Entlicher <mentlicher>
Status: VERIFIED FIXED    
Severity: normal CC: vaxquis
Priority: P3    
Version: 8.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:
Attachments: Null member tooltip
Null member of class with overridden toString

Description cezariusz 2015-04-28 12:08:07 UTC
Product Version: NetBeans IDE Dev (Build 201504270341)
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM 25.45-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_45-b14
System: Windows 7 version 6.1 running on amd64; UTF-8; pl_PL (nb)

Values displayed in tooltips for null member variables are incorrect. Looks like they show information about "this" instead of the variable.

Test case:

public class NullMember {

    String text;
    String dummy = "";

    public NullMember() {
    }

    public String doNothing() {
        String localNull = null;
        for (int i = 1; i < 10; i++) {
            if (text == null) {
                dummy += i;
            } else {
                dummy += text;
                localNull += this;
            }
        }
        return localNull;
    }

//    @Override
//    public String toString() {
//        return "Dummy is " + dummy;
//    }

}

Put a breakpoint in the "doNothing" method. Hover over "text" variable - it will show "package.name.NullMember@1175e2db" instead of simply "null.
Uncomment the "toString" method and it will become even more interesting - tooltip for "text" will show "Dummy is " instead of null.
Comment 1 cezariusz 2015-04-28 12:11:29 UTC
Created attachment 153430 [details]
Null member tooltip
Comment 2 cezariusz 2015-04-28 12:12:14 UTC
Created attachment 153431 [details]
Null member of class with overridden toString
Comment 3 Jiri Kovalsky 2015-04-28 12:14:29 UTC
Reproduced.
Comment 4 Martin Entlicher 2015-04-28 17:17:25 UTC
Reproduced as well. This is unfortunate. :-( Happens only with null variables.
Comment 5 Martin Entlicher 2015-04-29 09:57:06 UTC
Fixed by changeset:   287359:6272c5adfd1c
http://hg.netbeans.org/core-main/rev/6272c5adfd1c
Comment 6 Martin Entlicher 2015-04-29 12:57:41 UTC
An additional change applied, which disables the expandability of null values:
changeset:   287366:262e49bd804f
http://hg.netbeans.org/core-main/rev/262e49bd804f
Comment 7 Quality Engineering 2015-05-01 02:54:55 UTC
Integrated into 'main-silver', will be available in build *201505010001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6272c5adfd1c
User: mentlicher@netbeans.org
Log: #252138: Do not attempt to evaluate toString() on a null variable.
Comment 8 Jiri Kovalsky 2015-05-04 10:07:37 UTC
Product Version: NetBeans IDE Dev (Build 201505040001)
Java: 1.8.0_40; Java HotSpot(TM) 64-Bit Server VM 25.40-b25
Runtime: Java(TM) SE Runtime Environment 1.8.0_40-b25
System: Linux version 3.13.0-24-generic running on amd64; UTF-8; en_US (nb)

Verified.
Comment 9 vaxquis 2015-07-21 13:21:54 UTC
*** Bug 253493 has been marked as a duplicate of this bug. ***