mbien opened a new pull request, #9837:
URL: https://github.com/apache/netbeans/pull/9837

   the editor kept throwing exceptions when editing larger hint files.
   
   <details>
   
   ```
   SEVERE [org.openide.util.Exceptions]                                         
                                                                   jackpot 
parser crash
       java.lang.IllegalStateException: Caller of TokenSequence forgot to call 
moveNext/Previous() or it returned false (no more tokens)
       TokenSequence for text/x-javahints/text/x-java at tokenIndex=5. 
TokenList contains 5 tokens:                                                    
                      Context
       T[0]: "." F(1) DOT[82] FlyT, la=1, @730a7c74                             
                                                                                
             87,703 tokens
       T[1]: "isEmpty" <1055,1062> IDENTIFIER[1] DefT, la=1, @7e281885          
                                                                                
             44% used
       T[2]: "(" F(1) LPAREN[74] FlyT, @29e63b1c
       T[3]: ")" F(1) RPAREN[75] FlyT, @2e1caaf8
       T[4]: "\n" <1064,1065> WHITESPACE[124] DefT, la=1, @e558a93
         at 
org.netbeans.api.lexer.TokenSequence.checkTokenNotNull(TokenSequence.java:766)
         at org.netbeans.api.lexer.TokenSequence.offset(TokenSequence.java:240)
         at 
org.netbeans.modules.java.editor.base.semantic.TokenList$2.run(TokenList.java:123)
         at org.netbeans.editor.BaseDocument.render(BaseDocument.java:1407)
         at 
org.netbeans.modules.java.editor.base.semantic.TokenList.moveToOffset(TokenList.java:90)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.addChainedTypes(SemanticHighlighterBase.java:762)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethodInvocation(SemanticHighlighterBase.java:728)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitMethodInvocation(SemanticHighlighterBase.java:275)
         at 
com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1901)
         at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
         at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1090)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:275)
         at 
com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:504)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitExpressionStatement(SemanticHighlighterBase.java:810)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.visitExpressionStatement(SemanticHighlighterBase.java:275)
         at 
com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1680)
         at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:92)
         at 
org.netbeans.api.java.source.support.CancellableTreePathScanner.scan(CancellableTreePathScanner.java:69)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:1090)
         at 
org.netbeans.modules.java.editor.base.semantic.SemanticHighlighterBase$DetectorVisitor.scan(SemanticHighlighterBase.java:275)
         at com.sun.source.util.TreeScanner.scan(TreeScanner.java:110)
   ```
   
   </details>
   
   
   jackpot files embed java snippets and the token can be null when jumping out 
of a snippet which not a valid state. ts = null is however.
   
   Assisted-by: qwen3.8-27b (for regression test)
   
   
   


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