XCode refactoring: rename of autosynthesized properties does not rename ivar

Originator:syncluz
Number:rdar://12122448 Date Originated:2012-08-17
Status:Duplicate/12008280 Resolved:
Product:Developer Tools (XCode) Product Version:4.4.1 (4F1003)
Classification:Important Reproducible:Always
 
17-Aug-2012 07:35 PM Lukas Zeller:
Summary:

When using XCode refactoring to rename a property which is autosynthesized, and the implementation contains references to the autogenerated ivar (property name prefixed with one underscore), these references are not renamed.

Steps to Reproduce:

1) Create a test class as follows:

//  renameTest.h

#import <Foundation/Foundation.h>

@interface renameTest : NSObject

@property (strong, nonatomic) id testProperty;

@end



//  renameTest.m

#import "renameTest.h"

@implementation renameTest

- (id)init
{
  self = [super init];
  if (self) {
    _testProperty = nil;
  }
  return self;
}

@end


2) Use XCode refactor->rename to rename testProperty.

Expected Results:

references to the autogenerated ivar _testProperty should be renamed to match the new property name

Actual Results:

reference to _testProperty remains unchanged


Notes:

With the new autosynthesizing properties, the existence of the _ivar is no longer only a convention, but a inevitable consequence of declaring a property without providing setter AND getter. So refactor->rename should take care of renaming the _ivar.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!