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 243770 - Refactoring works wrongly if user modified code
Summary: Refactoring works wrongly if user modified code
Status: VERIFIED FIXED
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.1
Hardware: All All
: P2 normal (vote)
Assignee: Vladimir Voskresensky
URL:
Keywords:
: 244913 (view as bug list)
Depends on:
Blocks:
 
Reported: 2014-04-11 14:00 UTC by soldatov
Modified: 2015-02-25 10:22 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
the same a test project (8.77 KB, application/zip)
2014-11-17 11:55 UTC, Vladimir Kvashin
Details

Note You need to log in before you can comment on or make changes to this bug.
Description soldatov 2014-04-11 14:00:18 UTC
Code:

class A {
public:
    A();
private:
    int foo() const;
};

A::A() {
}

int A::foo() const {
    
}

int main() {
    return 0;
}

Scenario:
- Select A in "int A::foo() const {" line
- Type s
- Delete s
- Press Ctrl-R
- Type new name (for example "AS")
- Press Refactor button
===> invalid code:

class AS {
public:
    AS();
private:
    int foo() const;
};

AS::A() {
}

int AS::foo() const {
    
}

int main() {
    return 0;
}
Comment 1 Vladimir Kvashin 2014-11-17 11:55:39 UTC
Created attachment 150519 [details]
the same a test project
Comment 3 Quality Engineering 2014-11-19 04:08:00 UTC
Integrated into 'main-silver', will be available in build *201411190001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0dab43b16943
User: Vladimir Kvashin <vkvashin@netbeans.org>
Log: fixed #243770 - Refactoring works wrongly if user modified code
Comment 4 Vladimir Voskresensky 2014-11-19 16:18:12 UTC
*** Bug 244913 has been marked as a duplicate of this bug. ***
Comment 5 soldatov 2014-11-25 13:03:50 UTC
Ok. I can't reproduce original bug in NetBeans IDE 8.0.2 (Build 201411181905), but I replaced 2-3 steps only and see broken code again.

Scenario:
- Select A in "int A::foo() const {" line
- Press Ctrl-R
- Type new name (for example "A1")
- Press Refactor button
- Press Ctrl-Z (undo). Press Yes.
- Select A again
- Press Ctrl-R
- Type new name (for example "A2")
- Press Refactor button
==> broken code again

class A2 {
public:
    A2();
private:
    int foo() const;
};

A2::A() {
}

int A2::foo() const {
    
}

int main() {
    return 0;
}
Comment 6 soldatov 2014-11-25 13:14:03 UTC
But I can't break code in trunk
Comment 7 soldatov 2014-11-27 14:14:18 UTC
Really "NetBeans IDE 8.0.2 (Build 201411181905)" doesn't have fix.
Comment 8 Vladimir Voskresensky 2014-11-27 14:19:37 UTC
Note: the fix is in repository, but the bits were built on the different revision.
Comment 9 Vladimir Kvashin 2015-02-06 10:06:39 UTC
We were late for 8.0.2 with committing the fix, that's why 8.0.2 still has this bug. But the fix is already in releases/release801
Comment 10 soldatov 2015-02-24 08:45:18 UTC
verified in trunk

>System Info: 
  Product Version         = NetBeans IDE Dev (Build 201502240532) (#d6aa48dbbbfb)
Comment 11 soldatov 2015-02-25 10:22:52 UTC
verified in NetBeans IDE 8.0.2 (Build 201502242207)