Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 224783 - Rename Package Causes Phantom Error
Rename Package Causes Phantom Error
Product: editor
Classification: Unclassified
Component: Parsing & Indexing
PC Windows 7
: P1 (vote)
: 7.3
Assigned To: Tomas Zezula
: 224287 (view as bug list)
Depends on:
  Show dependency treegraph
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

project for reproduction of bug (31.85 KB, application/zip)
2013-01-12 16:00 UTC, MackSix
log file (55.35 KB, text/plain)
2013-01-12 16:01 UTC, MackSix
screenshot (115.83 KB, image/png)
2013-01-12 16:04 UTC, MackSix
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 and
4. Notice red badges on files and the method frame.setVisible() is not recognized in (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]
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
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 (upload may still be in progress)
User: Tomas Zezula <>
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 (upload may still be in progress)
User: Tomas Zezula <>
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:

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.
User: Tomas Zezula <>
Log: #224783:Rename Package Causes Phantom Error
Comment 23 Jiri Prox 2013-01-23 12:28:06 UTC

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo