Bug 210699 - No way to find all occurrences of a fixless hint
No way to find all occurrences of a fixless hint
Status: NEW
Product: java
Classification: Unclassified
Component: Hints
7.2
PC Linux
: P4 (vote)
: TBD
Assigned To: Svata Dedic
issues@java
: USABILITY
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-04-04 13:14 UTC by Jesse Glick
Modified: 2013-09-02 14:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2012-04-04 13:14:06 UTC
Suppose you have recently changed the element (or key) type on a collection in your (large) program. You have noticed a few places where the old element type is still in use in contravariant positions, because the editor displays a warning in those files, but you do not have time to open every single class in the program looking for this warning, and the Action Items window does not show them.

The obvious approach is to use Inspect & Transform. Assuming you can find the right hint in the long list - its name does not mention "collection", and there is an open RFE to do launch I&T with this hint as a pseudo-fix - and you run Refactor, you are just left with the error message

---%<---
The following warnings and errors were found. You can continue only with warnings.

List of Errors:

No fix for: Suspicious call to java.util.Map.get:
Given object cannot contain instances of String (expected URI) at Uses.java:14.
---%<---

So the warnings are listed in this dialog, but not in a usable way; clicking Preview just claims to find "no patterns".

Even when there is no automated fix for a warning, I expect to be able to get a dockable window of the Search Results type listing known occurrences with some manner of hyperlink, so that I can quickly navigate through potential problems and fix them (or @SuppressWarnings).
Comment 1 Jan Lahoda 2012-04-04 13:29:40 UTC
There of course is a way to do that in NB7.2: use Source/Inspect. There are a couple things broken around I&T, some of which I am going to fix by using this bug's number.

Also, no need to look for the warning in the combo, if you don't know which exact warning you are looking for: use the Browse button. The dialog also provides the "Search" function, and typing "Collection" will make it easy to find the warning (tested in I&T). This functionality is not working in Source/Inspect in the current dev builds, but fix is on the way under bug #210087.

Adding a subfix to find all similar warnings (and apply fixes to all similar warnings, if available) is definitely on the list, but there is *much* more on the list than what could possibly be done in foreseeable future, so no guarantees on when that will be implemented.
Comment 2 Jesse Glick 2012-04-04 18:28:56 UTC
(In reply to comment #1)
> There of course is a way to do that in NB7.2: use Source/Inspect.

Confirmed that Source > Inspect works for this use case. So could the I&T dialog gently point you in that direction when given a hint with no fixes?

> no need to look for the warning in the combo, if you don't know which
> exact warning you are looking for: use the Browse button.

Yes, I did this. Was looking for the text of the hint instance (as in status bar), which was not easily visible; needed to look for the title of hint instead.

> The dialog also provides the "Search" function

Good, did not see that.
Comment 3 markiewb 2013-07-03 21:38:41 UTC
(In reply to comment #1)
> 
> Adding a subfix to find all similar warnings (and apply fixes to all similar
> warnings, if available) is definitely on the list, but there is *much* more on
> the list than what could possibly be done in foreseeable future, so no
> guarantees on when that will be implemented.

For the record: This part is fixed in 7.3
http://wiki.netbeans.org/NewAndNoteworthyNB73#Run_inspections.26transform_for_wider_scope_from_fixable_hint_in_editor


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo