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 224783 - Rename Package Causes Phantom Error
Summary: Rename Package Causes Phantom Error
Status: VERIFIED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Parsing & Indexing (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P1 normal (vote)
Assignee: Tomas Zezula
URL:
Keywords:
: 224287 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-01-12 15:54 UTC by MackSix
Modified: 2013-01-23 12:28 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
project for reproduction of bug (31.85 KB, application/zip)
2013-01-12 16:00 UTC, MackSix
Details
log file (55.35 KB, text/plain)
2013-01-12 16:01 UTC, MackSix
Details
screenshot (115.83 KB, image/png)
2013-01-12 16:04 UTC, MackSix
Details
Test and possible fix. (7.15 KB, patch)
2013-01-14 17:09 UTC, Jan Lahoda
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description MackSix 2013-01-12 15:54:59 UTC

    
Comment 1 MackSix 2013-01-12 16:00:29 UTC
1. Open attached project in Netbeans.
2. Change package javaapplication1 to javaapplication21.
3. Open up NewJFrame.java and JavaApplication1.java.
4. Notice red badges on files and the method frame.setVisible() is not recognized in JavaApplication1.java (Cannot find symbol).

I waited a while and it would never resolve itself. Closing the project and reopening it usually does not correct it. 


Product Version: NetBeans IDE 7.3 RC1 (Build 201301102100)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
Comment 2 MackSix 2013-01-12 16:00:57 UTC
Created attachment 130135 [details]
project for reproduction of bug
Comment 3 MackSix 2013-01-12 16:01:52 UTC
Created attachment 130136 [details]
log file
Comment 4 MackSix 2013-01-12 16:04:25 UTC
Created attachment 130137 [details]
screenshot
Comment 5 MackSix 2013-01-12 16:23:13 UTC
This does not happen in 7.2.1. Regression P1
Comment 6 Jiri Prox 2013-01-14 08:01:56 UTC
*** Bug 224287 has been marked as a duplicate of this bug. ***
Comment 7 Jiri Prox 2013-01-14 08:08:51 UTC
Reproducible, 
the error badges goes away when the form file is opened.

It seems to be connected with GUI builder refactoring, I've tried to replace
NewJFrame with simple java class and this problem did not occur.
Comment 8 Sergey Petrov 2013-01-14 13:21:39 UTC
in my case there is no forms usage.
Comment 9 Sergey Petrov 2013-01-14 13:22:32 UTC
see steps from issue 224287
Comment 10 MackSix 2013-01-14 16:16:31 UTC
Sergey, I get the red badges repeating your steps described in bug 224287 on a regular java project with no forms and then if I open the classes in the editor the badges go away.
Comment 11 Jan Lahoda 2013-01-14 17:08:26 UTC
What I think is happening is that a file (or possibly several files) is sent multiple times into one invocation of JavaCustomIndexer.index. The JCI then passes them all at once into the javac, resulting into duplicate errors, and possibly also other confusion.

Ultimately, this is because (FileObject)Crawler creates two Indexables for one file, when both the file and one of its parent are sent to it as the crawling 'roots' ("files"). A patch that I will attach provides a test showing this behavior (FileObjectCrawlerTest.testDuplicateResults1). 

The patch also contains the best fix I was able to think up: it basically prevents crawling the same file multiple times. Basically, file or folder 'f' is skipped if one of its parents is also in among the crawling 'roots'. The overhead of the added computation is proportional to the number of crawling 'roots', not to the number of resulting Indexables, which might make it more acceptable. There is some additional overhead, both in terms of memory (the relPaths map is kept for the whole crawling) and computation (to find the parents), but it hopefully does not add additional disk accesses.
Comment 12 Jan Lahoda 2013-01-14 17:09:26 UTC
Created attachment 130192 [details]
Test and possible fix.
Comment 13 Tomas Zezula 2013-01-15 14:37:30 UTC
Fixed jet-main 6376abf26a19
Comment 14 Quality Engineering 2013-01-16 02:44:01 UTC
Integrated into 'main-golden', will be available in build *201301160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6376abf26a19
User: Tomas Zezula <tzezula@netbeans.org>
Log: #224783:Rename Package Causes Phantom Error
Comment 15 Tomas Zezula 2013-01-16 15:28:22 UTC
Next part of the fix :-)
jet-main c84e5ddff7f9
Comment 16 Tomas Zezula 2013-01-16 18:29:26 UTC
Added random test:
jet-main 5eb0c8c4c547
Comment 17 Quality Engineering 2013-01-17 02:49:45 UTC
Integrated into 'main-golden', will be available in build *201301170001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c84e5ddff7f9
User: Tomas Zezula <tzezula@netbeans.org>
Log: #224783:Rename Package Causes Phantom Error
Comment 18 Jan Lahoda 2013-01-17 11:17:33 UTC
The last version seems fine to me.
Comment 19 Jiri Prox 2013-01-17 15:27:08 UTC
verified in trunk
Comment 20 MackSix 2013-01-17 19:36:19 UTC
Works fine, except for this: http://netbeans.org/bugzilla/show_bug.cgi?id=225039


This bug happens in 7.2.1, so it's not regression.
Comment 21 Tomas Zezula 2013-01-18 10:25:42 UTC
Transplanted into NB 7.3: dd42a1adfcaa, 41ec96535177
Comment 22 Quality Engineering 2013-01-19 00:02:52 UTC
Integrated into 'releases', will be available in build *201301182100* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/dd42a1adfcaa
User: Tomas Zezula <tzezula@netbeans.org>
Log: #224783:Rename Package Causes Phantom Error
Comment 23 Jiri Prox 2013-01-23 12:28:06 UTC
verified