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 244049 - Broken code completion in 80patch1 for core platform objects/methods
Summary: Broken code completion in 80patch1 for core platform objects/methods
Status: VERIFIED FIXED
Alias: None
Product: javascript
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Linux
: P1 normal (vote)
Assignee: Petr Pisl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-24 14:02 UTC by Vladimir Riha
Modified: 2014-04-26 10:24 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screencast (1.31 MB, video/ogg)
2014-04-24 14:02 UTC, Vladimir Riha
Details
IDE log (50.25 KB, text/plain)
2014-04-24 14:03 UTC, Vladimir Riha
Details
IDE log from 8.0 daily (33.67 KB, text/plain)
2014-04-24 14:44 UTC, Vladimir Riha
Details
nbm file with the changed timestamps of stub files (350.93 KB, application/octet-stream)
2014-04-25 15:14 UTC, Petr Pisl
Details
nbm file with the original stub file. (350.31 KB, application/octet-stream)
2014-04-25 15:16 UTC, Petr Pisl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2014-04-24 14:02:12 UTC
Created attachment 146923 [details]
screencast

After upgrading NetBeans 8.0 All to patch1:
  - install NetBeans 8.0 all distro
  - activate PHP and JavaWeb by creating new projects
  - update to patch1 using catalog link from [1]

code completion in JS file is missing all global objects/methods like window, Date, document etc. If I declare simple variable in JS file

var a = new Date();
a.

=> properties/methods of Dates are not offered. Please check the screencast to see how almost empty completion is. The same happens with embedded JS in HTML file.


[1] http://wiki.netbeans.org/NetBeans_80_Patch1_GoNoGo


Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 1 Vladimir Riha 2014-04-24 14:03:08 UTC
Created attachment 146924 [details]
IDE log
Comment 2 Vladimir Riha 2014-04-24 14:09:53 UTC
The same works in 

Product Version: NetBeans IDE Dev (Build 201404230001)
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Vladimir Riha 2014-04-24 14:41:05 UTC
It works in 8.0 daily build as well. So it seems to be caused by the update process.


Product Version: NetBeans IDE 8.0 (Build 201404240045)
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)
Comment 4 Vladimir Riha 2014-04-24 14:44:30 UTC
Created attachment 146925 [details]
IDE log from 8.0 daily

Here's IDE log from the 8.0 daily build, versions of javascript2.* modules seems to be identical...
Comment 5 Petr Pisl 2014-04-25 07:49:42 UTC
I have tried the build from releases/release80 and it works as well. Investigating more.
Comment 6 Petr Pisl 2014-04-25 09:29:20 UTC
The problem is in the index. The patch of javascript editor increases the version  of js index. So when the ide is restarted after update, all the sources and js stabs in folder netbeans/ide/jsstabs should be reindexed and new version of the js index should be created. 

I don't know the reason, but new index version 12 is not created correctly for the jsstabs zip files. There is only created folder 12 (version of the new index), which is empty. The index for sources of opened projects are created correctly. When you delete the cache dir and start the ide again, the all sources and js stabs file are reindexed again and the indexes are created correctly. Then the editor works as expected.

So the question is, why the index is not created for js stabs after the update. Also I had at least two cases, when the index was created correctly during the update.
Comment 7 Petr Pisl 2014-04-25 09:34:42 UTC
Tome, do you have an idea, why it behaves in this way?
Comment 8 Petr Pisl 2014-04-25 10:42:16 UTC
I have switch on in JsIndexer through the -J-Dorg.netbeans.modules.javascript2.editor.index.level=FINE option, which logs what is indexed. See http://hg.netbeans.org/web-main/file/e2b219b3fab8/javascript2.editor/src/org/netbeans/modules/javascript2/editor/index/JsIndexer.java#l83 where is logged the path for the file that is indexed.

In the case, when the reindexing after the update is not done correctly, the log looks

INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/NetBeansProjects/Angular/simpleProject/public_html took: 4,950 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 2 source roots took: 5,080 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 12 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/reststubs.zip took: 25 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/domstubs.zip took: 34 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/corestubs.zip took: 15 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 3 source roots took: 74 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]



Notice the time of indexing reststubs.zip took: 25 ms, domstubs.zip took: 34 ms and corestubs.zip took: 15 ms. The times are fast, and the js indexer was not called for the files.

In the case when it works correctly the log looks:

INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/NetBeansProjects/Angular/simplePro
ject/public_html took: 5,388 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 1 ms]
FINE [org.netbeans.modules.javascript2.editor.index.JsIndexer]: Indexing: jsstubs/stub_DOM_Crypto.js, fullPath: jsstubs/stub_DOM
_Crypto.js
... 
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/reststubs.zip took: 632 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
FINE [org.netbeans.modules.javascript2.editor.index.JsIndexer]: Indexing: jsstubs/stub_DOM_AbstractView.js, fullPath: jsstubs/stub_DOM_AbstractView.js
...
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/domstubs.zip took: 1,136 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
FINE [org.netbeans.modules.javascript2.editor.index.JsIndexer]: Indexing: jsstubs/stub_CORE_unescape.js, fullPath: jsstubs/stub_CORE_unescape.js
...
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/ppisl/ide/nb8-all/netbeans/ide/jsstubs/corestubs.zip took: 268 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 0 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 5 source roots took: 7,734 ms (New or modified files: 0, Deleted files: 0) [Adding listeners took: 3 ms]

Notice that the time of indexing the stabs are longer reststubs.zip took: 632 ms, domstubs.zip took: 1,136 ms and corestubs.zip took: 268 ms. Also there are fine logs from the JsIndexer, that the files are indexed.

So it looks like the RepositoryUpdater doesn't call the JsIndexer in such case. It looks like problem in the RepositoryUpdater.
Comment 9 Tomas Zezula 2014-04-25 12:34:52 UTC
It's because the stubs.zip timestamp does not changed and also it's not registered in the GPR on when indexer fires its version has changed. The stubs.zip are registered much later when first request on javascript indexer is done.
Comment 10 Petr Pisl 2014-04-25 13:44:22 UTC
Thanks Tomas, now I understand. Unfortunately I don't see, what I can do with this except to don't register the stabs lazy. But there is reason, why these stubs are registered lazy.
Comment 11 Petr Pisl 2014-04-25 15:13:13 UTC
Ok now we have a workaround. I have created the js stubs zipfiles, where all the stub files have changed timestamps. So the indexer repository will refresh them even if they will not be registered in GPR yet, because it looks lie they are changed. In fact there was changed only the timestemp, no content. The new stub files are uploaded to the external binaries, so the patch only includes change in the binaries-list file. 

It's committed now to the web-main: http://hg.netbeans.org/web-main/rev/b140e2069538


The stub files are a part of the javascript editor nbm. I attach the nbm that is build from releases/release80 branch and you can test it.
Comment 12 Petr Pisl 2014-04-25 15:14:35 UTC
Created attachment 146941 [details]
nbm file with the changed timestamps of  stub files

It
Comment 13 Petr Pisl 2014-04-25 15:16:55 UTC
Created attachment 146942 [details]
nbm file with the original stub file.

This is for testing purposes. When you take NB 80 and install this nbm file (which is a part of the patch) then you should be possible to reproduce the issue. When you install the nbm with the changed timestamps, you should not.
Comment 14 Vladimir Riha 2014-04-25 15:58:10 UTC
Thank you, I've tried 5 times the "good" nbm (install full distro, activate something, install nbm) and it worked every time. I tried the "bad" nbm as well and reproduced the issue on it every time. Verified. Please integrate to releases. Thanks
Comment 15 Petr Pisl 2014-04-25 16:03:37 UTC
Transplanted to the releases/release80
Comment 16 Vladimir Riha 2014-04-26 10:24:07 UTC
Verified in patch, thank you

Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1
Java: 1.8.0_05; Java HotSpot(TM) Client VM 25.5-b02
Runtime: Java(TM) SE Runtime Environment 1.8.0_05-b13
System: Linux version 3.2.0-60-generic-pae running on i386; UTF-8; en_US (nb)