This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 250791 - with custom hint, UI does not display refactoring changes
Summary: with custom hint, UI does not display refactoring changes
Status: REOPENED
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on: 267482
Blocks:
  Show dependency tree
 
Reported: 2015-02-28 22:14 UTC by err
Modified: 2016-08-08 12:52 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
test case (31.72 KB, application/zip)
2015-03-01 07:00 UTC, err
Details

Note You need to log in before you can comment on or make changes to this bug.
Description err 2015-02-28 22:14:04 UTC
Doing "inspect and transform" or "inspect..." with a custom hint, for example
    ==================================
       new java.util.LinkedList()
    => new java.util.ArrayList()
    ;;
    ==================================

after doing the Inspect phase, the results show up in the output window.

Click on the large yellow "down button" (the third icon from the top)
and observe that the specific inspection or transformation is not displayed.
Comment 1 err 2015-03-01 02:00:02 UTC
I can't reproduce this.
Comment 2 err 2015-03-01 06:58:52 UTC
I am attaching a reproducible test case. To reproduce:

- Add the custom hint below to the IDE
- unzip CustomHintRefactorUi.zip
- open CustomHintRefactorUi and its children,
  There are three modules displayed.
- select Mod2
- Menu>Refactor>SelectAndTransform
  Leave current scope as ...(Mod2)
  Select Inspection: custom hint that was added earlier
- press Inspect button

Observe: the refactoring window opens, there are several rewrites
I see "...[11 occurances]"
Press the large orangish down button (3rd icon from the top) repeateadly.
Notice the rewrite selected in the left window changes, but the position
in the diff window-pair does not change (other than to go to a different
file).

Expect: the diff window-pair should show the rewrite selected in the left
window.


========= custom hint ==================
<!description="search println">

   java.lang.System.err.println($args)
=> org.metawb.lib.TestUtil.tout($args)
;;

   java.lang.System.err.printf($args$)
=> org.metawb.lib.TestUtil.toutf($args$)
;;

   java.lang.System.out.println($args)
=> org.metawb.lib.TestUtil.tout($args)
;;

   java.lang.System.out.printf($args$)
=> org.metawb.lib.TestUtil.toutf($args$)
;;
Comment 3 err 2015-03-01 07:00:01 UTC
Created attachment 152301 [details]
test case
Comment 4 err 2015-03-01 07:10:03 UTC
(I forgot to mention, I believe it does the refactor correctly)

I now see that if I manually add the line:
        import org.metawb.lib.TestUtil;
to each of the files *before* doing the refactor, then the Refactor window works correctly.
Comment 5 Ralph Ruijs 2015-03-06 14:53:30 UTC
(In reply to err from comment #4)
> (I forgot to mention, I believe it does the refactor correctly)
> 
> I now see that if I manually add the line:
>         import org.metawb.lib.TestUtil;
> to each of the files *before* doing the refactor, then the Refactor window
> works correctly.

Imho the refactor window works correctly even without adding the import statement. Every single transformation will need the import statement to be added. Looking at a single one will show a diff with a new import statement as the first change in the file.
Comment 6 err 2015-03-06 19:26:24 UTC
I just tried this with a build I made a few days ago. It still has the problem. Oh, I see, now that I reread your statement, I understand what you are saying. However, I still believe that it is not acting correctly and that it is a bug. Perhaps the case of mutliple changes to a file, for a single refactoring, was not considered in the original UI design.

The purpose of the diff window is to review the changes to the file. When I hit the display-next button I expect to see the next change (and eventually all the changes), but not all the changes are displayed. The only way to see all the change is to either scroll the window or click on the tiny change bar at the far right. Either of these is inconsistent with the regular diff window UI and also extremelyh cubersome to use for reviewing many changes.

In other words, continuously clicking on the "next change" button does not show all the changes, this is a bug.
Comment 7 Svata Dedic 2016-08-08 12:52:14 UTC
It's not a bug (at least not code bug); I see that it is annoying that the diff view focuses "uninteresting" changes introduced by e.g. code style (classes used by simple name, FQNs imported) instead of the 'real' change. But the IDE does not support the concept of "important" or "implied" changes at all!

But interesting idea; automatic code changes implied by IDE tools could eventually mark the affected regions, so they can be recognized and possibly skipped.

I filed a reminder issue for java.source to provide necessary API and standard behaviour.