akronenw opened a new issue, #4745:
URL: https://github.com/apache/netbeans/issues/4745

   ### Apache NetBeans version
   
   Apache NetBeans 15
   
   ### What happened
   
   I am working on a project that includes a bunch of JS files. When I open the 
project, the indexing always gets stuck at a random percentage and it is always 
while indexing the `paper-full.js` script (taken from 
https://cdnjs.cloudflare.com/ajax/libs/paper.js/0.12.15/paper-full.js which is 
linked from https://cdnjs.com/libraries/paper.js).
   
   This is annoying as NB becomes slower and slower and finally freezes after a 
while.
   
   ### How to reproduce
   
   Create a new JS project with all default values. Paste the content of the 
linked `paper-full.js` into the `main.js` (or copy the entire file into the 
project). Reopen NB so the scanning/indexing begins. 
   
   ### Did this work correctly in an earlier version?
   
   No / Don't know
   
   ### Operating System
   
   macOS Monterey Version 12.5.1, Apple M1
   
   ### JDK
   
   OpenJDK 64-Bit Server VM Zulu17.34+19-CA (build 17.0.3+7-LTS, mixed mode, 
sharing)
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   I dug a bit into the indexing code and added a bunch of logs.
   * In `JsObjectImpl#getFullyQualifiedName` the while loop runs endlessly 
because the `pObject` in there seems to have itself as parent (of which I am 
pretty sure is responsible for the slowness and ultimately the freeze). I did 
not yet understand how this situation can occur codewise.
   * The `DefineInterceptor#intercept` method, which (by javadoc, a rare thing 
there) is supposed to return a collection of the return types of a function, 
always returns an empty collection. I do not know how that affects anything. 
Also, there is a for loop/switch combination that possibly only handles one 
function argument.
   * A few other things, but that is probably because I have no clue about JS.
   
   In the paper-js.full script is the following code:
   
   ```
   var Base = new function() {
        // a lot of code
   
       function Base() {
           // some code
       }
   
       // more code
   }
   ```
   which I suppose is the problem, because the JS indexing somehow mixes up the 
inner and outer method names and eventually one gets itself as parent, causing 
the endless while loop. I might be completely wrong about this.
   
   Interestingly, the minified version is indexed without any problems. I 
believe this is because the minification process renames everything (uniquely?) 
and there are no nested functions with identical name. Again, I'm guessing. 
   
   ### Are you willing to submit a pull request?
   
   Yes
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to