Skip to content
This repository has been archived by the owner on Oct 18, 2024. It is now read-only.

[Bug]: Chased on implementing abstract methods #916

Open
2 tasks done
MrIkso opened this issue Apr 3, 2023 · 1 comment
Open
2 tasks done

[Bug]: Chased on implementing abstract methods #916

MrIkso opened this issue Apr 3, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@MrIkso
Copy link
Contributor

MrIkso commented Apr 3, 2023

What happened?

Chased on implementing abstract methods

What's the expected behavior?

No crash

What version of AndroidIDE you're using?

v2.4.0 (debug builds)

Relevant log output

AndroidIDE crash report
Manufacturer: samsung
Device: SM-M526B
ABI: arm64-v8a
SDK version: 33
App version: v2.4.1-beta.internal.1+branch.dev.commit.402c3f6.timestamp.20230331184636 (241)

 Stacktrace: 
java.lang.StringIndexOutOfBoundsException: Column 48 out of bounds. line: 76 , column count (line separator included):10
	at io.github.rosemoe.sora.text.Content.checkLineAndColumn(Content.java:1059)
	at io.github.rosemoe.sora.text.Content.insertInternal(Content.java:357)
	at io.github.rosemoe.sora.text.Content.insert(Content.java:350)
	at com.itsaky.androidide.lsp.IDELanguageClientImpl.lambda$editInEditor$2(IDELanguageClientImpl.java:268)
	at com.itsaky.androidide.lsp.IDELanguageClientImpl$$ExternalSyntheticLambda2.run(Unknown Source:4)
	at android.os.Handler.handleCallback(Handler.java:942)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loopOnce(Looper.java:226)
	at android.os.Looper.loop(Looper.java:313)
	at android.app.ActivityThread.main(ActivityThread.java:8741)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

Duplicate issues

  • This issue has not been reported yet.

Code of Conduct

  • I agree to follow this project's Code of Conduct
@MrIkso MrIkso added the bug Something isn't working label Apr 3, 2023
@itsaky
Copy link
Member

itsaky commented Apr 4, 2023

Can you provide more information about the issue? Maybe a sample file?

itsaky added a commit that referenced this issue Jul 21, 2023
When the 'keepComments' flag is set, the compiler uses JavadocTokenizer for tokenizing the source code. While creating the LineMap instance, the JavadocTokenizer sets the 'expandTabs' flag to true which expands '\t' characters to spaces. This is needed while generating HTML pages for the Javadoc. However, if the tabs are expanded to spaces, then getPosition(...) and getColumnNumber(...) methods in the LineMap class return indices which cannot be directly used to insert text in the source code. This results in StringIndexOutOfBoundsException when trying to insert text in the editor (#1127, and probably #916 as well).

This commit adds the 'keepCommentsOverride' option to the compiler which is used by NBParserFactory to override the 'keepComments' flag. The CompileBatch class sets this option to 'ignore' which ignores the 'keepComments' flag so that JavadocTokenizer is not used for tokenization.
itsaky added a commit that referenced this issue Aug 5, 2023
When the 'keepComments' flag is set, the compiler uses JavadocTokenizer for tokenizing the source code. While creating the LineMap instance, the JavadocTokenizer sets the 'expandTabs' flag to true which expands '\t' characters to spaces. This is needed while generating HTML pages for the Javadoc. However, if the tabs are expanded to spaces, then getPosition(...) and getColumnNumber(...) methods in the LineMap class return indices which cannot be directly used to insert text in the source code. This results in StringIndexOutOfBoundsException when trying to insert text in the editor (#1127, and probably #916 as well).

This commit adds the 'keepCommentsOverride' option to the compiler which is used by NBParserFactory to override the 'keepComments' flag. The CompileBatch class sets this option to 'ignore' which ignores the 'keepComments' flag so that JavadocTokenizer is not used for tokenization.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants