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 250081 - Introduce local variable refactoring produces garbled results
Summary: Introduce local variable refactoring produces garbled results
Status: RESOLVED WORKSFORME
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 8.0.2
Hardware: PC Linux
: P3 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-01-28 22:28 UTC by mclaborn
Modified: 2015-09-18 14:08 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (869.69 KB, text/plain)
2015-01-28 22:28 UTC, mclaborn
Details
screen shot before refactoring (50.44 KB, image/png)
2015-01-28 22:30 UTC, mclaborn
Details
screen shot after refactoring (42.38 KB, image/png)
2015-01-28 22:30 UTC, mclaborn
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mclaborn 2015-01-28 22:28:39 UTC
Product Version = NetBeans IDE 8.0.2 (Build 201408251540)
Operating System = Linux version 3.13.0-44-generic running on amd64
Java; VM; Vendor = 1.7.0_76
Runtime = Java HotSpot(TM) 64-Bit Server VM 24.76-b04

Has similar symptoms to 248785, but reporting separately as it is a different type of refactoring. Screen shots will be supplied shortly.  
An "introduce local variable" refactoring with 3 occurrences, marking final, produces very garbled output and does not refactor every occurrence.
Comment 1 mclaborn 2015-01-28 22:28:46 UTC
Created attachment 151718 [details]
IDE log
Comment 2 mclaborn 2015-01-28 22:30:11 UTC
Created attachment 151719 [details]
screen shot before refactoring
Comment 3 mclaborn 2015-01-28 22:30:47 UTC
Created attachment 151720 [details]
screen shot after refactoring
Comment 4 mclaborn 2015-01-28 22:32:54 UTC
Seems similar in symptoms to 248785
Comment 5 Svata Dedic 2015-02-02 14:09:41 UTC
I'v tried with a simplistic example but I didn't reproduce the defect; could you try to edit the example adding constructs (not the exact text, but rather the structure) like your real source code so it starts trigger the defect ?

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author sdedic
 */
public class BugRefactoring {
    private List<C> workingOrders = new ArrayList<>();
    
    public void foo(boolean par) {
        workingOrders.get(0).addCartPayment(0);
        if (par) {
            workingOrders.get(0).addCartPayment(1);
        } else {
            workingOrders.get(0).addCartPayment(2);
        }
    }
    
    public C getSomeValue() {
        return null;
    }

    static class C  {
        public void addCartPayment(int a) {
            
        }
    }
}
Comment 6 mclaborn 2015-02-02 16:26:31 UTC
I can no longer reproduce this problem, even on a full version of that class.
Comment 7 Svata Dedic 2015-09-18 14:08:11 UTC
OK, closing as WORKSFORME until reproduction is found