Skip to content
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: Fix crash on handling parameterized ProblemReferenceBinding #3964

Merged
merged 9 commits into from
Jun 2, 2021

Conversation

slarse
Copy link
Collaborator

@slarse slarse commented May 28, 2021

Fix #3951

The problem is described in the issue. It's very rare for JDT to parse a parameterized type reference to a ProblemReferenceBinding (even when the actual referenced type can't be resolved). In the particular case of error code 15 (using a type that isn't closable on a try-with-resources), it does however resolve the reference to a ProblemReferenceBinding with type parameters in the name, which caused the crash.

This PR does not attempt to parse the type arguments, it only fixes the crash and lets the pre-existing logic for creating type references from problem bindings do its thing. In other words, a type reference is created with the correct simple name, and that's about it. A warning that the type arguments are ignored is also issued.

I found a way to actually resolve the correct type binding in the particular corner case represented in the test case I added, which I may add in a later PR as that coincidentally triggers the long-standing bug reported in #3708.

@slarse slarse changed the title wip: fix: Fix incorrect parsing parameterized ProblemReferenceBinding wip: fix: Fix incorrect parsing parameterized ProblemTypeBinding May 28, 2021
@slarse slarse changed the title wip: fix: Fix incorrect parsing parameterized ProblemTypeBinding wip: fix: Fix incorrect parsing parameterized ProblemReferenceBinding May 28, 2021
@slarse
Copy link
Collaborator Author

slarse commented May 31, 2021

Waiting for #3966

@slarse
Copy link
Collaborator Author

slarse commented Jun 1, 2021

This turns out to be a massive pain. Resolving anything beyond the simple name of the type is really error-prone, as JDT provides next to no information.

@slarse slarse changed the title wip: fix: Fix incorrect parsing parameterized ProblemReferenceBinding wip: fix: Fix crash on handling parameterized ProblemReferenceBinding Jun 1, 2021
@slarse slarse changed the title wip: fix: Fix crash on handling parameterized ProblemReferenceBinding review: fix: Fix crash on handling parameterized ProblemReferenceBinding Jun 1, 2021
@monperrus monperrus changed the title review: fix: Fix crash on handling parameterized ProblemReferenceBinding fix: Fix crash on handling parameterized ProblemReferenceBinding Jun 2, 2021
@monperrus monperrus merged commit 10959bf into INRIA:master Jun 2, 2021
@monperrus
Copy link
Collaborator

Thanks @slarse

I feel your pain, having myself spent a lot of time workarounding ProblemReferenceBinding

@slarse slarse deleted the issue/3951-not-allowed-javaletter branch June 2, 2021 06:13
@monperrus monperrus mentioned this pull request Aug 19, 2021
woutersmeenk pushed a commit to woutersmeenk/spoon that referenced this pull request Aug 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Not allowed javaletter or keyword in identifier found
2 participants