AppCode 2.5 indexing not consistently up-to-date... is this a bug or a glitch I can fix
Since upgrading to AppCode 2.5, my indexing has been working inconsistently.
For example, searches are missing results that are known to be there and are found in XCode searches
Many selectors are noted as "not used" when they clearly are used
Sometimes, indexing appears to work, suddenly, like the correct indices are there, but were being ignored.
Sometimes it appears that when making a minor edit, like deleting and re-adding a property definition, will cause the correct indexing to be used.
I didn't see any other topics about this, so I am suspicious that there is something that I may be able to do to manually delete the indices to prevent this intermittent behavior.
Anyone know how to get my indexing behavior to work consistently? Is there a definitive way to manually delete the index files to make sure that AppCode is re-indexing from scratch? That would be helpful for me to discover if the behavior I'm seeing is easily reproducible.
Thanks,
James
Please sign in to leave a comment.
Related bugs:
OC-8579 No indexing
OC-6761 AppCode loses method usages
Also, under the File menu is the "Invalidate Caches and Restart" option, which I somehow missed before...
Please update to 2.5.1 first to avoid environment issues of 2.5. Try to invalidate current caches then (File | Invalidate Caches / Restart...).
Thanks, I just updated and rebuilt the indices.
So far, the search is working but AppCode is still reporting some properties as unused when they are used. Let me know if I can help narrow down the problem.
In the example I'm looking at, there are properties in a private unnamed category that are used in that class that appear as unused.
For example:
@Interface Foo ()
@property (nonatomic, strong) Bar *bar //shows up as unused, though used below in "initializeBar"
@end
@implementation Foo
- (void) initializeBar {
self.bar = [[Bar alloc] init];
}
@end
I love Jetbrains products... good luck with the bugs... I'm a big user of AppCode and IDEA.
James
What's the message of this warning? You can find it with Cmd+F1 while caret is positioned on the grey-colored "bar" or by moving mouse pointer to the yellow stripe on the right scrollbar.
It should say "Property 'bar' is assigned but never accessed". For it to disappear 'bar' should be accessed somewhere.
It reads as "Property Bar is never used"
In my actual code example, it is both assigned and used in the class.
I see. Could you please check if it's reproducible in new example project or if it's a project-specific thing?
It works appropriately in a new test project. The warning is also correct in the sample test project when the property is assigned, but not used.
Here's my test code from the new project:
#import "AppCodeUsageTest.h"
@interface AppCodeUsageTest () //not used
@property NSString *thisPropertyIsUsed; //used
@end
@implementation AppCodeUsageTest { //not used
}
- (id)init {
self = [super init];
if (self) {
self.thisPropertyIsUsed = @"hello";
}
return self;
}
-(void)doSomethingWithProperty { //not used
NSLog(@"property: %@", self.thisPropertyIsUsed);
}
@end
James, am I right that this issue with "unused property" is always present in your "big" project even after you rebuild the indices?
Please try to run the batch inspections, is this wrong inspection present in the batch inspection results?
Short answer, yes, I see at least some wrong results even in the batch inspection result
longer answer...
When I tried to run the code inspections manually, I am seeing some suspicious behavior which may or may not be related.
When I run the inspections on the "Whole Project," it returns immediately with "No suspicious code found." If I run inspections on my topmost directory of my project, which seems like essentially the same thing, I see a message like:
"Analyzing code in .../App1/App1/App1/App1/App1/..."
Which seems strange, but it does go on to complete the inspection in this case. Once finished and comparing the inspection results with the editor display results, I see some inconsistencies:
1) Several cases where the property declared in a header file is inspected as "unused" but is displayed in the editor without any inspection markings. I am not sure if it is actually used or not. Currently, the unused annotation is set to display a warning, and it is doing so in many other cases.
2) Some cases in AppDelegate.m with properties in a private category are marked in the editor and inspection results as "never used" when they should be "assigned but not used"
3) At least one of the classes I originally noticed with this problem are still having the problem where the editor is reporting "never used" but I am both assigning and using the object in the same class. This is a property declared in a private category in the .m file.
At this point, it seems the vast majority of the indexing/editor marks are working appropriately. I'm not sure what's causing these problems to stick.
Thanks,
James
James,
1) There are legal cases when the batch inspector reports thing as unused, but it's not highlighted in the editor - it's because the latter skips the words which have a lot of text occurences, like "add", "run", etc (it's some kind of optimization).
2 & 3) We still can't reproduce these issues, but keep trying. If you re-execute the inspector, will it report the same wrong results?
Hi James,
my name is Artur, I'm from QA team. You've faced significant bug and it's important for us to fix it. Could you please provide some more additional information for me to reproduce the problem:
1. What kind of private categories are used for property declaration? Named or unnamed category?
2. What attributes are used in properties for which you've got 'unsued' inspection?
3. Could you please attach your AppCode settings: zip whole AppCode folder from ~/Library/Preferences/appCode20/
Thank you
Artur,
I appreciate the followup... I spent some more time analyzing the problem to answer your questions. Here are the answers you're looking for.
1) The categories are unnamed
2) For properties that appear as unused, it appears that what I am seeing is that readonly properties declared in the header file are unused if they are not used outside of the class. That is, the public property declaration is unused, only the private property is used. I may have been confused by this before. I don't have any unused properties at this time that are incorrect, it seems.
3) Let me know if you still want this attachment. As of right now, it seems that the "Inspect Code..." results are correct.
Further comments:
I have a memory of seeing the private read/write property appear as unused in the editor. This may have been an example of the editor being out of sync with the "Inspect Code..." results. Then, upon running "Inspect Code...", the property that I saw was marked unused in the editor was indeed marked unused in the "Inspect Code..." result as well. Bug, right? Well, actually not, because those properties were also declared as readonly in the header file as well. Thus the "Inspect Code..." results were correct, and my line of reasoning from the editor markup to the "Inspect Code..." results was mistaken.
So, my best guess is that I'm entirely wrong or there was some mis-labeling of unused property in the editor combined with actual unused public property declarations that resulted in my error.
Sorry for any confusion from my end!
James Walsh
James, thank you for clear description. But I still need AppCode settings, it might be smth wrong with configuration. You can send it directly to my mail artur.novak@jetbrains.com
Thanks