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 254876

Summary: IDE has unresolved identifiers in refactored code ("Introduce Function" action)
Product: cnd Reporter: soldatov <soldatov>
Component: ProjectAssignee: Alexander Simon <alexvsimon>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 8.1   
Hardware: PC   
OS: Solaris   
Issue Type: DEFECT Exception Reporter:

Description soldatov 2015-08-31 13:56:12 UTC
Often in automatic tests we create empty project and add existing file from external directory. In this case "Introduce Function" action breaks code assistance.

C++ code:
int main(int argc, char** argv) {
    int i = 1;
    i++;
    i++;
    return 0;
}

Scenario:
- Create empty C++ Application in /export/files/NB (/export/files/NB/CppApplication_1 folder will appear)
- Add existing /export/files/test.cpp file via "Add Existing Item..." menu item
- Select "i++;" line and press Alt-Shift-M (Introduce Function)
- Press Refactor button
==> a lot of unresolved identifiers
Comment 1 soldatov 2015-08-31 14:07:00 UTC
Other related bug.

C++ code:
int foo1() {
    return 0;
}

int main(int argc, char** argv) {
    foo1();
    return 0;
}

Scenario:
- Create empty C++ Application in /export/files/NB (/export/files/NB/CppApplication_1 folder will appear)
- Add existing /export/files/test.cpp file via "Add Existing Item..." menu item
- Select "foo1();" line and press Ctrl-R
- Type foo2 and Press Refactor button
==> ok
- Select "foo2();" line and press Ctrl-R
- Type foo3 and Press Refactor button
==> old code in editor
Comment 2 Alexander Simon 2015-09-02 14:00:02 UTC
The cause of the bug is:
- the added item is not located under source root.
Indexing/Parsing API does not support files that do not belong source root.
Comment 3 Alexander Simon 2015-09-03 08:42:06 UTC
fixed, change set:
http://hg.netbeans.org/cnd-main/rev/6576d639ca3e
Comment 4 Quality Engineering 2015-09-04 01:24:52 UTC
Integrated into 'main-silver', will be available in build *201509040002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6576d639ca3e
User: Alexander Simon <alexvsimon@netbeans.org>
Log: fixed Bug #254876 IDE has unresolved identifiers in refactored code ("Introduce Function" action)