apache / netbeans

Apache NetBeans
https://netbeans.apache.org/
Apache License 2.0
2.63k stars 840 forks source link

Implement suppress warnings on for Unused hint and codeAction for suppress warnings annotations #7548

Closed Achal1607 closed 1 month ago

Achal1607 commented 2 months ago

Unused suppress warning was not showing up in netbeans IDE, so fixed that. Netbeans already had option for providing suppress warnings hint in the sub-menu. So, leveraged that piece of code to extend this capability in the VS Code CodeActions as well. Introduced suppress warnings hint in vscode.

image

In the above image. "- >" represents subfixes.

For more info refer: https://github.com/oracle/javavscode/issues/96

lahodaj commented 1 month ago

I think @dbalek or @sdedic would be better reviewers than me, as I've been too involved in the discussion on this patch development.

neilcsmith-net commented 1 month ago

@lahodaj sure, but you're also marked as the author on HintsController and HintsControllerImpl so you seemed a good person to suggest an alternative to reflection with regard to @mbien comment (which I happen to agree is something of a red flag)

Achal1607 commented 1 month ago

Can @dbalek or @sdedic review this PR and provide some suggestions to avoid use of reflection or any more changes that has to be done?

mbien commented 1 month ago

can we change the PR title to "Implement suppress warnings on for Unused hint" or something similar? I think this makes more sense for the NetBeans release notes which are generated from PR titles, I suppose javavscode has their own release notes.

Achal1607 commented 1 month ago

@mbien updated PR title

Achal1607 commented 1 month ago

Thank you so much @mbien for helping in fixing the performance issue with this PR, I have incorporated your patch as well in this PR and squashed the PR.

mbien commented 1 month ago

@neilcsmith-net does the https://github.com/apache/netbeans/labels/do%20not%20merge tag still apply?

mbien commented 1 month ago

@Achal1607 small small conflict due to https://github.com/apache/netbeans/pull/7579 unfortunately. I saw that whitespace change and thought gh would be able to merge, but apparently not.

mbien commented 1 month ago
[PR branch]
git pull --rebase https://github.com/apache/netbeans.git master
[fix merge conflict]
git add java/java.hints/src/org/netbeans/modules/java/hints/infrastructure/JavaErrorProvider.java
git rebase --continue

should work I think. It would put the commit on top of latest master.

Achal1607 commented 1 month ago

Thank you so much @mbien for helping out on this PR. I have resolved the merge conflicts. Thanks.