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 123428

Summary: Wrong guarded block detection after variable declaration block
Product: java Reporter: Jiri Prox <jiriprox>
Component: SourceAssignee: Svata Dedic <sdedic>
Status: RESOLVED WONTFIX    
Severity: blocker CC: mmirilovic
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Jiri Prox 2007-12-05 09:51:01 UTC
Product Version: NetBeans IDE 6.0 (Build 200711261600)
Java: 1.6.0_03-ea; Java HotSpot(TM) Client VM 1.6.0_03-ea-b01
System: Linux version 2.6.5-1.358 running on i386; UTF-8; en_US (nb)

The end of guarded block is detected wrongly for variable declaration block in form file. 

Steps to reproduce:
1) create new form file
2) add several component to it
3) type "int x;" just below the variable declaration block (guarded block where are declared components)
4) do Safe Delete on x
-> preview claims that the variable x is declared in guarded block, and it is not deleted
Comment 1 Jiri Prox 2008-04-11 00:54:17 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 2 Rastislav Komara 2009-02-03 10:57:43 UTC
Overtake.
Comment 3 Sergey Petrov 2009-04-14 16:18:55 UTC
reproducible with 6.7m3
Comment 4 Jan Lahoda 2009-08-20 10:01:03 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 5 Marian Mirilovic 2012-10-17 10:32:16 UTC
reproducible in NB 7.2.1 ... only if you place it right after the block, any new line between the block and new declaration allows delete without any problems
Comment 6 Svata Dedic 2014-08-29 11:42:21 UTC
Possibly a refactoring issue ? It seems that the filtered (without GEN-BEGIN / GEN-END) markers is taken as a base, but the refactored result it used without filtering; which makes the IDE (incorrectly) detect change in the guarded area.

Please investigate
Comment 7 Ralph Ruijs 2014-09-23 13:35:56 UTC
(In reply to Svata Dedic from comment #6)
> Possibly a refactoring issue ? It seems that the filtered (without GEN-BEGIN
> / GEN-END) markers is taken as a base, but the refactored result it used
> without filtering; which makes the IDE (incorrectly) detect change in the
> guarded area.
> 
> Please investigate

The comment, the one with GEN-END, is tied to the variable decl. int x;. Removing this variable tree from the class, CasualDiff incorrectly removes the comment with it. The diffs from CasualDiff are used to check if there will be changes in the guarded area.
Comment 8 Martin Balin 2016-07-07 07:17:20 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss