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 214455 - NB erroneously attempts to create a FieldBreakpoint instead of a Line breakpoint on an anonymous inner class
Summary: NB erroneously attempts to create a FieldBreakpoint instead of a Line breakpo...
Status: VERIFIED FIXED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.2
Hardware: PC Windows 7
: P2 normal (vote)
Assignee: Martin Entlicher
URL:
Keywords: REGRESSION
Depends on:
Blocks:
 
Reported: 2012-06-19 15:55 UTC by swpalmer
Modified: 2012-06-28 09:17 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
can't set breakpoint on line 20 (13.96 KB, application/zip)
2012-06-22 20:15 UTC, swpalmer
Details
better example (14.09 KB, application/zip)
2012-06-22 20:30 UTC, swpalmer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2012-06-19 15:55:32 UTC
Product Version = NetBeans IDE Dev (Build 201206180001)
Operating System = Windows 7 version 6.1 running on x86
Java; VM; Vendor = 1.7.0_04
Runtime = Java HotSpot(TM) Client VM 23.0-b21

Click on a line in a simple PropertyChangeListener that is implemented as an anonymous inner class I get the following error and no breakpoint:
Not able to submit breakpoint FieldBreakpoint my.package.SaveToPluginNewOrExisting$1.pluginDetailsListener, reason: Field 'pluginDetailsListener' does not exist in class my.package.SaveToPluginNewOrExisting$1.

The thing is "pluginDetailsListener" is the instance variable where I'm storing the anonymous inner class. So the error is stating that this instance variable that is a member of SaveToPluginNewOrExisting is not part of the anonymous class itself which would be SaveToPluginNewOrExisting$1

I'm trying to set a breakpoint inside the propertyChange method, but it won't let me.,  I have done clean builds both within NB and using the MAven command line.  I can confirm that the method is compiled and running.  If I right-click on the line and toggle a line breakpoint it marks the break point, but then fails to set it when the class loads at runtime.
Comment 1 Martin Entlicher 2012-06-21 14:26:00 UTC
Well, I'm playing with various anonymous PropertyChangeListeners and I;m not able to reproduce the issue.
Clicking gives me just an ordinary line breakpoint. Both inside the propertyChange() method and on the 
pluginDetailsListener = new PropertyChangeListener() { ... line.
I've tested in both ANT and Maven Java projects.

Can you please provide a code sample, which manifests this bug?
Comment 2 swpalmer 2012-06-22 20:15:23 UTC
Created attachment 121234 [details]
can't set breakpoint on line 20
Comment 3 swpalmer 2012-06-22 20:17:23 UTC
Sample project attached.
Can't set a breakpoint on line 20
Can for lines 31,32

This is very similar to the original report, but in it somehow a field breakpoint got configured - which always failed to get created at runtime.  In any case, the common thing is that the line in the PropertyChangeListener refuses to have a breakpoint set on it.
Comment 4 swpalmer 2012-06-22 20:19:45 UTC
Note that the supplied project is so simplified that it makes no sense to set a breakpoint because none of the code actually runs.  The point is that the breakpoint can't even be set prior to running code, even in cases where the code will run.
Comment 5 swpalmer 2012-06-22 20:29:46 UTC
I replaced the example with one that is more runnable

You can set a breakpoint on line 46, but not on line 22.

At runtime I get:

Listening on javadebug
User program running
LineBreakpoint BreakPointBug.java : 46 successfully submitted.
Not able to submit breakpoint FieldBreakpoint
bug.report.BreakPointBug$1.computeReadyListener, reason: Field
'computeReadyListener' does not exist in class bug.report.BreakPointBug$1.
Breakpoint hit at line 46 in class bug.report.BreakPointBug by thread
AWT-EventQueue-0.
Thread AWT-EventQueue-0 stopped at BreakPointBug.java:46.
Comment 6 swpalmer 2012-06-22 20:30:15 UTC
Created attachment 121236 [details]
better example
Comment 7 swpalmer 2012-06-22 20:32:19 UTC
Latest tests were with build 201206220002
Comment 8 swpalmer 2012-06-22 20:33:58 UTC
The example is Ant-based. I tried to make a Maven project for a test case, but creating a new Maven project is broken in build 201206220002 - separate issue already opened.
Comment 9 Martin Entlicher 2012-06-22 23:31:44 UTC
Thanks for the example, I've reproduced the bug.
Comment 10 Martin Entlicher 2012-06-25 13:15:46 UTC
Unfortunately, this is a regression, the line breakpoints work fine in this case in 7.1.

Fixed by changeset:   225017:2173f5b2994e
http://hg.netbeans.org/main/rev/2173f5b2994e
Comment 11 Jiri Kovalsky 2012-06-25 14:43:23 UTC
Let's have this fixed in 7.2 then. Thanks Scott for the repro steps!
Comment 12 Quality Engineering 2012-06-26 04:55:45 UTC
Integrated into 'main-golden', will be available in build *201206260002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/2173f5b2994e
User: mentlicher@netbeans.org
Log: #214455: Stop searching for a field when we're in a method body.
Comment 13 Jiri Kovalsky 2012-06-26 10:11:01 UTC
Product Version: NetBeans IDE Dev (Build 201206260002)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/dev
Cache directory: /home/cesilko/.cache/netbeans/dev

Verified in today's trunk build. Please integrate the fix to release72 branch. Thanks!
Comment 14 Martin Entlicher 2012-06-26 15:17:56 UTC
It's pushed into release72 as changeset:   232264:e81fe7a04ec7
http://hg.netbeans.org/releases/rev/e81fe7a04ec7
Comment 15 Quality Engineering 2012-06-27 03:07:09 UTC
Integrated into 'releases', will be available in build *201206262201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/e81fe7a04ec7
User: mentlicher@netbeans.org
Log: #214455: Stop searching for a field when we're in a method body.
(transplanted from 2173f5b2994e5d8b5eb073006631ee421963bfb7)
Comment 16 Jiri Kovalsky 2012-06-28 09:17:19 UTC
Product Version: NetBeans IDE 7.2 RC1 (Build 201206262201)
Java: 1.7.0_04; Java HotSpot(TM) 64-Bit Server VM 23.0-b21
System: Linux version 3.0.0-12-generic running on amd64; UTF-8; cs_CZ (nb)
User directory: /home/cesilko/.netbeans/7.2rc1
Cache directory: /home/cesilko/.cache/netbeans/7.2rc1

Verified.