matthiasblaesing commented on issue #3669:
URL: https://github.com/apache/netbeans/issues/3669#issuecomment-1053669219


   Putting the discussion about the indexer in general aside the issue here is 
that the indexer does not handle self referential structures well. A minimal 
reproducer is this:
   
   ```
   function mod(actions) {
       return actions.map((action) => {
           action = { action };
           return action;
       });
   };
   ```
   
   With that at least the occurrences finder:
   
   ```
   java.lang.StackOverflowError
        at 
org.netbeans.modules.javascript2.editor.navigation.OccurrencesSupport.findOccurrence(OccurrencesSupport.java:59)
        at 
org.netbeans.modules.javascript2.editor.navigation.OccurrencesSupport.findOccurrence(OccurrencesSupport.java:80)
        at 
org.netbeans.modules.javascript2.editor.navigation.OccurrencesSupport.findOccurrence(OccurrencesSupport.java:80)
        at 
org.netbeans.modules.javascript2.editor.navigation.OccurrencesSupport.findOccurrence(OccurrencesSupport.java:80)
   ```
   
   and the indexer are affected:
   
   ```
   java.lang.StackOverflowError
        at java.base/java.util.WeakHashMap.get(WeakHashMap.java:398)
        at 
org.openide.util.lookup.InheritanceTree.searchInterface(InheritanceTree.java:846)
        at 
org.openide.util.lookup.InheritanceTree.lookup(InheritanceTree.java:215)
        at 
org.openide.util.lookup.DelegatingStorage.lookup(DelegatingStorage.java:149)
        at 
org.openide.util.lookup.AbstractLookup.lookupItem(AbstractLookup.java:411)
        at 
org.openide.util.lookup.AbstractLookup.lookup(AbstractLookup.java:396)
        at org.openide.util.lookup.ProxyLookup.lookup(ProxyLookup.java:281)
        at 
org.netbeans.modules.javascript2.model.JsElementImpl.isInternalFile(JsElementImpl.java:194)
        at 
org.netbeans.modules.javascript2.model.JsElementImpl.isPlatform(JsElementImpl.java:188)
        at 
org.netbeans.modules.javascript2.model.api.IndexedElement$Flag.getFlag(IndexedElement.java:387)
        at 
org.netbeans.modules.javascript2.editor.index.JsIndexer.createDocument(JsIndexer.java:122)
        at 
org.netbeans.modules.javascript2.editor.index.JsIndexer.storeObject(JsIndexer.java:222)
        at 
org.netbeans.modules.javascript2.editor.index.JsIndexer.storeObject(JsIndexer.java:230)
        at 
org.netbeans.modules.javascript2.editor.index.JsIndexer.storeObject(JsIndexer.java:230)
        at 
org.netbeans.modules.javascript2.editor.index.JsIndexer.storeObject(JsIndexer.java:230)
   ```
   
   the immediate idea is using a Map/Set to store the visited maps would fix 
this, but that breaks intentional usages.


-- 
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