Avoiding crash during indexing when a record has a component with a wrong name. #6649
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Considering code like:
This produces an error, as
wait
is not a valid record component name. And it will leave aSymbol.RecordComponent.accessor
empty. Which probably is OK in the front-end, but the back end expects this to be filled. As a consequence, the indexing crashes with an exception:oracle/javavscode#52
Generally, in
VanillaCompileWorker.dropMethodsAndErrors
we try to fix erroneous ASTs, so that classfiles/sig files can be generated for them. In this case, my proposal is to fill theaccessor
field with a dummy value -Lower
will see is as a user-provided accessor, and do nothing. The test shows how the resulting classfile will look like (including making it unloadable).