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 254448 - Bad preview for first occurence of refactoring
Summary: Bad preview for first occurence of refactoring
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Refactoring (show other bugs)
Version: 8.1
Hardware: PC Windows 10 x64
: P3 normal (vote)
Assignee: Ralph Ruijs
URL:
Keywords: REGRESSION
: 254455 254767 254768 255200 (view as bug list)
Depends on:
Blocks:
 
Reported: 2015-08-17 17:08 UTC by stwr
Modified: 2015-10-12 08:24 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
No preview for the first occurence - 1st match (45.92 KB, image/png)
2015-08-17 17:09 UTC, stwr
Details
No preview for the first occurence - 2nd match (46.43 KB, image/png)
2015-08-17 17:09 UTC, stwr
Details
Correct preview for non-first occurence(s) (49.19 KB, image/png)
2015-08-17 17:10 UTC, stwr
Details
Screenshot History Diff View (208.67 KB, image/png)
2015-09-18 16:41 UTC, MackSix
Details
Logfile History Diff View (74.80 KB, text/plain)
2015-09-18 16:42 UTC, MackSix
Details

Note You need to log in before you can comment on or make changes to this bug.
Description stwr 2015-08-17 17:08:48 UTC
Product Version: NetBeans IDE Dev (Build 201508170002)
Java: 1.8.0_60-ea; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-ea-b25
System: Windows 10 version 10.0 running on amd64; Cp1250; pl_PL (nb)

Test Case --> http://services.netbeans.org/synergy/client/app/#/case/4966/suite/2018/v/1

Always the first, entire, occurence is affected. In this case it is first ClassB.
There is no preview like it is available for all next occurences.
Comment 1 stwr 2015-08-17 17:09:17 UTC
Created attachment 155398 [details]
No preview for the first occurence - 1st match
Comment 2 stwr 2015-08-17 17:09:33 UTC
Created attachment 155399 [details]
No preview for the first occurence - 2nd match
Comment 3 stwr 2015-08-17 17:10:09 UTC
Created attachment 155400 [details]
Correct preview for non-first occurence(s)
Comment 4 stwr 2015-08-17 17:16:52 UTC
The issue is reproducible also for other test cases in this suite but I will not mark them as Failed because refactoring actually works.
Comment 5 stwr 2015-08-17 17:19:52 UTC
Preview for the Move Member is affected as well.
Comment 6 manikantannaren 2015-08-24 14:42:56 UTC
Click Logical view
Select elements of rename.ClassB
Refactored ClassB view is empty

Select "Update references to ClassA" in of usages.ClassB
Refactored ClassB view is now populated.

Issue seems to be with classes in same package only.
Comment 7 Jiri Prox 2015-08-25 10:26:32 UTC
reproducible


Product Version: NetBeans IDE Dev (Build 201508250002)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\dev
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\dev
Comment 8 Jiri Prox 2015-08-25 11:35:40 UTC
*** Bug 254455 has been marked as a duplicate of this bug. ***
Comment 9 Jiri Prox 2015-08-27 08:26:00 UTC
*** Bug 254768 has been marked as a duplicate of this bug. ***
Comment 10 Jiri Prox 2015-09-02 14:06:54 UTC
*** Bug 254767 has been marked as a duplicate of this bug. ***
Comment 11 Jiri Prox 2015-09-11 08:02:09 UTC
*** Bug 255200 has been marked as a duplicate of this bug. ***
Comment 12 Ralph Ruijs 2015-09-14 07:54:01 UTC
Lowering priority, the refactoring is performed correctly and we are not able to reproduce it anymore.

If there are reproducible steps, please attach them to this issue. Thanks!
Comment 13 MackSix 2015-09-14 12:51:48 UTC
(In reply to Ralph Ruijs from comment #12)
> Lowering priority, the refactoring is performed correctly and we are not
> able to reproduce it anymore.
> 
> If there are reproducible steps, please attach them to this issue. Thanks!

It does not necessarily happen the first time, but it may happen if I click Cancel and try again. 

I also see that sometimes the preview will show the preview of the sub class, but sometimes it shows the class it was invoked on. That is odd behavior. Which one is it supposed to show the preview for?

This is what I do to see it happen:

Create a simple Maven Java project with two classes; one extending the other like:


public class MuhClass {
    private int x = 0;
    private String s = "";

    public int getX() {
        return x;
    }

    public void setX(int x) {
        this.x = x;
    }

    public String getS() {
        return s;
    }

    public void setS(String s) {
        this.s = s;
    }
}


public class MuhSubClass extends MuhClass {
    
}

2. Put focus on MuhClass in Project window and invoke Push Down from its context menu. 
3. Select all 4 getters/setters and click Preview button.
4. Does the preview shows in right pane? Does the preview show for class you invoked Push Down on (MuhClass.java) or does it show a preview for the sub class (MuhSubClass)? In either case, click Cancel and try again.  
5. If it still doesn't occur after 4 times, Put focus on MuhSubClass in Project widow and invoke Push Down from its context menu.
6. Notice error message because there is no subclass to push down too. Click Cancel button. 
7. Repeat step #3 again. 
8. Try restarting NetBeans and try again and you should see the class preview switch to the other class or a preview failure.
Comment 14 MackSix 2015-09-18 16:41:36 UTC
Created attachment 156282 [details]
Screenshot History Diff View

I am seeing a failure of the preview in History Diff view and I&T Diff views.

This is a screenshot of a failure of a Diff view accompanied by an exception. See attached logfile. 

The exception reporter sent the exception here to an exception report resolved as invalid. http://statistics.netbeans.org/analytics/detail.do?id=182847
Comment 15 MackSix 2015-09-18 16:42:08 UTC
Created attachment 156283 [details]
Logfile History Diff View
Comment 16 Jiri Prox 2015-10-09 19:50:18 UTC
My steps to reproduce:
1) open PushPull project from Refactoring 3 test specification
http://services.netbeans.org/synergy/client/app/#/title/refactoring_3/
2) open VIPCustomer class
3) call pull up
4) select addAccount(...) method and SuperBaseCustomer as a target
5) click on preview
Comment 17 Jiri Prox 2015-10-09 19:51:40 UTC
Product Version: NetBeans IDE 8.1 RC (Build 201510012201)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 7 version 6.1 running on amd64; Cp1250; en_US (nb)
User directory: C:\Users\jprox\AppData\Roaming\NetBeans\8.1rc
Cache directory: C:\Users\jprox\AppData\Local\NetBeans\Cache\8.1rc
Comment 18 Ralph Ruijs 2015-10-12 08:24:12 UTC
Thank you for the steps to reproduce, but it seems to be windows specific as it works fine for me on:

Product Version: NetBeans IDE Dev (Build 20151012-e4ab88b98c9f)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Linux version 4.2.2-1-ARCH running on amd64; UTF-8; en_US (nb)


I'll need to find some windows machine to evaluate further.