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

Summary: Introduce local variable refactoring produces garbled results
Product: java Reporter: mclaborn <mclaborn>
Component: HintsAssignee: Svata Dedic <sdedic>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: P3    
Version: 8.0.2   
Hardware: PC   
OS: Linux   
See Also: https://netbeans.org/bugzilla/show_bug.cgi?id=248785
Issue Type: DEFECT Exception Reporter:
Attachments: IDE log
screen shot before refactoring
screen shot after refactoring

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