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 244913 - C++ refactoring sometimes messed up code
Summary: C++ refactoring sometimes messed up code
Status: RESOLVED DUPLICATE of bug 243770
Alias: None
Product: cnd
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0.1
Hardware: PC Linux
: P3 normal (vote)
Assignee: issues@cnd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-06-05 13:20 UTC by theghostdog
Modified: 2014-11-19 16:18 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description theghostdog 2014-06-05 13:20:02 UTC
Hello,

i have a C++ project from source. Sometimes, I aim to refactorise my code, it messed it up. 

For example: I have a method which contains a miss spelled word and i wont fix it via the refactor capabilities of NB.

Assume a method declaration within the header file comparable to:

virtual void setTreshholdToPeers(const ResourceValue newThresholdValue);

The refactoring goal is to rename the method to setThresholdToPeers. Unfortunately, in some cases, NB refactor the method declaration to something comparable like this:

setTreshholdToPeerssetsetTreshholdToPeersTreshholdToPeers(const ResourceValue newThresholdValue);

There are additional more variants. If I start the refactoring within the header file, usually only the method declaration is refactored and messed up, the definition within the source file remains unchained. If I start the refactoring within the source file, much more code is messed up.

best
Comment 1 Alexander Simon 2014-06-06 05:46:20 UTC
Hi theghostdog,

Could you provide IDE info (first lines of IDE log or content of about dialog)?
Is bug can be reproduced on C/C++ sample?

Alexander
Comment 2 theghostdog 2014-06-06 08:53:23 UTC
Hello Alexander,

unfortunately not. But during testing with the sample projects, I observe additional refactoring issues. I create the Quote example and open the Module class, more precisely the module.h file. I click on the SetCategory method and open via right-click the refactoring menu. I renamed the method to SetCategory11. After this, I switching to the source file and check the results. All seems as expected. I rename the method again to SetCategoryHH, requesting the refactoring from the source file. Calling Ctrl+R again, issues an error, what parameter or function refactoring does not working without declaration (or something similar). Checking the header file reveals that the last refactoring only renamed the method within the source file, not in the header file. 

Regrettably, this proceeding is not reproducible. I run the same activities afterwards again, but NB operates fine. There is in addition now exception or similar stuff, which signals an error. 

The IDE log provides:

INFO [org.netbeans.modules.cnd.api.project.NativeProjectRegistry]: Open native project Quote_1 /home/XXXXXX/Quote_1
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Resolving dependencies took: 1 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 0 binary roots took: 0 ms
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Indexing of: /home/gaebljan/Quote_1 took: 736 ms (New or modified files: 17, Deleted files: 0) [Adding listeners took: 4 ms]
INFO [org.netbeans.modules.parsing.impl.indexing.RepositoryUpdater]: Complete indexing of 1 source roots took: 736 ms (New or modified files: 17, Deleted files: 0) [Adding listeners took: 4 ms]
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@5f70a10d called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@2db1eefe called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@4241ae7d called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@79bc242e called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@2d5e36bb called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@2bad1c7f called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@4fae4c44 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@48de84c0 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@694383b0 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@289e9c9d called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@347808a6 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@3b986823 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@7f55120d called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@1975f9e2 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@32c70b07 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@449d409c called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@864207f called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@24e32492 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@7bf47992 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@7d8acf70 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@78e285b5 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@3eada740 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@79041f90 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@60b1969b called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@759a8120 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@257596ac called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@52ddbf0d called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@3dc0cded called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.AbstractRefactoring$ProgressL@7c2a8850 called start multiple times
INFO [org.netbeans.modules.refactoring.spi.impl.ParametersPanel]: org.netbeans.modules.refactoring.api.RefactoringSession@58260f called start multiple times

Thus, everything looks nice. :(

The requested IDE properties are:
Product Version: NetBeans IDE 8.0 (Build 201403101706)
Updates: NetBeans IDE is updated to version NetBeans 8.0 Patch 1.1
Java: 1.7.0_55; OpenJDK 64-Bit Server VM 24.51-b03
Runtime: OpenJDK Runtime Environment 1.7.0_55-mockbuild_2014_04_16_12_11-b00
System: Linux version 2.6.32-431.11.2.el6.x86_64 running on amd64; UTF-8; en_US (nb)
User directory: /home/XXXXXXX/.netbeans/8.0
Cache directory: /home/XXXXXXX/.cache/netbeans/8.0


My system is Centos 6.

best regards
Comment 3 Alexander Simon 2014-06-06 09:21:03 UTC
Thanks,

Probably the issue is an another manifestation of the bug #244073 which going to 
be fixed in patch 2.

Alexander
Comment 4 theghostdog 2014-06-06 09:47:38 UTC
Hey Alexander,

indeed, the refactoring issue found in the sample file seems to be correlated with the bug provided by you. but the initial bug seems for me a little bit different. 

best
Comment 5 Vladimir Kvashin 2014-11-19 16:06:08 UTC
This might be a duplicate of bug 243770 that has been fixed yesterday
Comment 6 Vladimir Voskresensky 2014-11-19 16:18:12 UTC
Could you try, please, 
http://bits.netbeans.org/download/8.0.2/daily/9dad33/2014-11-18_19-05-13/

And reopen if you still can reproduce.

Thanks!

*** This bug has been marked as a duplicate of bug 243770 ***