-
Notifications
You must be signed in to change notification settings - Fork 223
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
StackOverFlow when indexing Jars with self-referencing Class-Path:
#2086
Comments
Thank you for reporting and tracking down the root cause of the issue!
A PR would be appreciated 👍 Your change looks good to me. We can also maintain a set of "visited paths" to avoid infinite recursion if the cyclic reference is not direct. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Discovered when using ScalaMetals (v0.9.1):
https://gist.github.com/faizk/df7cde49b2c581df9971ea5f58c8eec4
On closer examination, I found at least one third-party JAR
(my
build.sbt
is basically a bunch ofunmanagedJars in Compile : = ..
, etc) that is self-referential:Given a jar file
MyJar.jar
:I'm not sure that Jars such as these are even valid, but they do break tools, so perhaps handling such situations
is a good idea (either silently skip but warn about it, or throw an exception describing the problematic input).
I can't imagine there would be a specification that says that the
Class-Path:
attr can never resolve to the name of the original jar file - that doesn't make sense, so I think protecting against just a situation is called for,Likely -
https://github.com/scalameta/scalameta/blob/master/semanticdb/metacp/src/main/scala/scala/meta/internal/classpath/ClasspathIndex.scala#L134-L165
I just tried a quick fix on the lines of
Which fixes the issue for me, so I can send a PR (to stop recursing and maybe log a warning) - unless I find after some more research on this that there's a better way.
The text was updated successfully, but these errors were encountered: