Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.IndexOutOfBoundsException in ANTLRLexerAdaptor.toLexerState #31

Closed
ris58h opened this issue May 8, 2023 · 1 comment
Closed
Labels

Comments

@ris58h
Copy link

ris58h commented May 8, 2023

It happens for injected languages when startOffset is not zero and initialState is zero. In this case stateCache is empty and we get:

java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:458)
	at org.antlr.intellij.adaptor.lexer.ANTLRLexerAdaptor.toLexerState(ANTLRLexerAdaptor.java:280)
	at org.antlr.intellij.adaptor.lexer.ANTLRLexerAdaptor.start(ANTLRLexerAdaptor.java:168)
	at com.intellij.lexer.HtmlHighlightingLexer$XmlEmbeddmentHandler.handleElement(HtmlHighlightingLexer.java:269)
	at com.intellij.lexer.BaseHtmlLexer.advance(BaseHtmlLexer.java:415)
	at com.intellij.lexer.HtmlHighlightingLexer.advance(HtmlHighlightingLexer.java:173)
@bjansen bjansen added the bug label Sep 25, 2023
@ris58h
Copy link
Author

ris58h commented Oct 15, 2023

I've ended up with a hack to work around the issue but I'm not sure if it's a right way to fix it.

@bjansen bjansen closed this as completed in a49e2be Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants