-
Notifications
You must be signed in to change notification settings - Fork 357
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
Fix Symbol$CompletionFailure crash when building CFG #6397
Fix Symbol$CompletionFailure crash when building CFG #6397
Conversation
… declared type is an interface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@msridhar Something in this pull request significantly degrades run-time performance. I've run CI 3 times and wasn't able to complete within the timeout any of those times. Could you look into improving that? Maybe use the original code, but catch the exception and if the exception is caught, use your new code. |
@mernst I'm puzzled by the CI failure. It seems the only job failing is |
@msridhar I didn't see anything obviously non-performant in your code. Feel free to add any logging you want to this pull request; we can remove or comment it out before merging. I just triggered a new build (as opposed to re-running the failed build). |
I'm seeing the failure on the master branch of my fork (https://github.com/mernst/checker-framework/commits/master/). I'm running some other tests now. |
This reverts commit 07da606.
// calling that method crashes with a Symbol$CompletionFailure exception. See | ||
// https://github.com/typetools/checker-framework/issues/6396. The code below directly searches | ||
// all supertypes for the method and avoids the crash. | ||
Name closeName = names.fromString("close"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this call is potentially costly, which is why the Checker Framework doesn't use Name
s very often. So you could try making it a field.
Co-authored-by: Michael Ernst <mernst@cs.washington.edu>
Fixes #6396
It turns out the crash occurred inside the
javax.lang.model.util.Elements#getAllMembers
method, which was called to find the implementation ofclose()
to invoke for a resource in a try-with-resources block. I don't know the exact cause, but it looks like that method tries to resolve all members in all superclasses of the argument, which is leading to a crash with this specific third-party jar file. I suspect the root cause of the crash is somewhere else. (Maybe in the Scala compiler? The jar seems to include Scala-generated classes.) But, as a workaround, it seems that if we search for the method more directly, only looking for members with the name"close"
, the crash is avoided. I'm not 100% thrilled with this fix, but it's the best I can come up with at this point to avoid this crash.