-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
java.lang.ArrayIndexOutOfBoundsException when parsing /*
#60
Comments
*/
/*
reported again today on Discord (one of @bjornregnell's students hit it) |
Yes this was a bit frustrating for the beginner student - I guess it is easy to get bitten by this when you try to find what is wrong in your code by de-commenting stuff here and there with |
NOTE: it is enough to have a code file with a single |
Also we were first confused about where it crashed and long suspected the scala compiler which was a bit worrying until we understood that it was the runner. |
Minimal reproduction: $ scala-cli version
Scala CLI version: 1.5.1
Scala version (default): 3.5.1
$ mkdir empty && cd empty
$ echo "/*" | cat >a.scala
$ scala-cli compile a.scala
Error: java.lang.ArrayIndexOutOfBoundsException: Index -2147483648 out of bounds for length 3
For more details, please see '/home/bjornr/tmp/empty/.scala-build/stacktraces/1729085559-18129846909220856422.log'
$ head .scala-build/stacktraces/1729085559-18129846909220856422.log
java.lang.ArrayIndexOutOfBoundsException: Index -2147483648 out of bounds for length 3
com.virtuslab.using_directives.custom.CustomCharArrayReader.nextChar(CustomCharArrayReader.java:29)
com.virtuslab.using_directives.custom.Scanner.lambda$skipComment$5(Scanner.java:298)
com.virtuslab.using_directives.custom.Scanner.skipComment(Scanner.java:308)
com.virtuslab.using_directives.custom.Scanner.doFetchToken(Scanner.java:187)
com.virtuslab.using_directives.custom.Scanner.fetchToken(Scanner.java:144)
com.virtuslab.using_directives.custom.Scanner.nextToken(Scanner.java:98)
com.virtuslab.using_directives.custom.Scanner.<init>(Scanner.java:27)
com.virtuslab.using_directives.custom.Parser.<init>(Parser.java:20)
com.virtuslab.using_directives.UsingDirectivesProcessor.extract(UsingDirectivesProcessor.java:34) |
Och, that should actually be fixed, we can close it |
The following source file will cause the parser to hang before emitting java.lang.ArrayIndexOutOfBoundsException
errors with
Workaround: surround with quotes.
Context
I tried out prototyping a directive where one of the values was a raw glob pattern, e.g.
//> using sourceGenerator foo.scala **/*.proto
The text was updated successfully, but these errors were encountered: