Test and preliminary fix for issue with "USE_VAR" cleanup #1538
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.
Reproducer for
#1525
The "fix" included seems to be a kind of bold hack. A good fix might need a changes to some underlying classes that can not really handle parametrized types for import removal in the case of type interference.
What it does
For the case of using diamond operater the underlying class to remove the imports of the instance expression is fed with the expression without the type so arraylist<> instead of arraylist. The junit tests are fine but I do not trust this approach so much. And it seems to me there is really a lack of support for paramerized types in the classes in charge to handle the import removal. Maybe it is fine because within the scope of the code changes of this cleanup it is good enough?
How to test
Try to run it over jdtui code sources. There are several cases where this error pops up.
Author checklist