Old name of renamed files (using refactoring) keep appearing in the Navigate->File... menu entry

Issue #1166 new
Toni Garcia-Die created an issue

Old name of renamed files (using refactoring) keep appearing in the Navigate->File... menu entry but new ones not.

As you can see in the attached file, the "Recipient" class, previously "RecipientInformation" class does not show in the drop down, but the old name does.

To reproduce it I guess you just have to rename a class using the Refactor->Rename method.

Comments (17)

  1. Scott Wells repo owner

    Interesting. I wasn't able to reproduce this, but I'll keep trying. Are there any errors in your idea.log after a rename (Help>Show Log in Explorer/Finder/Files)? Does the problem go away if you close/reopen the project? If not, what if you rebuild caches & indices? Trying to figure out what might be getting wedged...

  2. Toni Garcia-Die reporter

    Hi Scott, thank you very much for trying. I use just one instance of Idea+IC to manage several branches of the same project. I guess this could affect.

    I have been checking Idea.log and found:

    2018-11-09 16:39:05,746 [ 69484] INFO - ab.ApexClassSymbolTableAdapter - Adapted source into symbol table for sirenum_devtg01__RecipientInformation in 10 ms. at this time and much before, this class didn't exist anymore, as "RecipientInformation" became plain "Recipient"

    And: 2018-11-09 17:03:09,535 [ 585497] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 1: Recipient 2018-11-09 17:03:21,181 [ 597143] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 1: SingleMessageRenderer_Test 2018-11-09 17:03:28,101 [ 604063] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 1: RecipientInformation 2018-11-09 17:03:46,485 [ 622447] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 1: SingleMessageRenderer_Test 2018-11-09 17:03:46,488 [ 622450] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 5: basicTest() : void 2018-11-09 17:03:46,488 [ 622450] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 6: IsPersonalisedTest() : void 2018-11-09 17:03:46,489 [ 622451] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 8: setup() : void 2018-11-09 17:03:46,493 [ 622455] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 5: basicTest() : void 2018-11-09 17:03:46,493 [ 622455] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 6: IsPersonalisedTest() : void 2018-11-09 17:03:46,494 [ 622456] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 8: setup() : void 2018-11-09 17:04:06,529 [ 642491] WARN - ntellij.ui.tree.AsyncTreeModel - ignore duplicated child at 1: Recipient

    As you can see, for some reason and perhaps is not IC fault, classes "Recipient" and "RecipientInformation" co-exist. But "Recipient" does not show in the Navigate->File...

    There are other classes that were renamed and do not display in this menu neither, but no clear cases in the log entry.

    Other log files idea.log.## seem to display just error messages.

    Hope this helps!

    Thank you again!

    Best,

    Toni

  3. Scott Wells repo owner

    Ah, I think I see. So the class with the old name is in your offline symbol table (OST). Let me explain how that works and maybe it'll help clarify what might be happening here. When you generate your OST, Illuminated Cloud renders a "stub" class for every custom class in the org that you don't have in the local project source. This includes Apex classes from installed managed packages, but it also includes any "loose" (i.e., unpackaged) Apex classes which have been deployed to the org but not included in the local filesystem for the project. This can cause confusion in the following situation:

    1. A class named Foo exists in the org but not in the local project.
    2. You generate your OST resulting in a Foo.cls in OfflineSymbolTable.zip. This allows you to refer to Foo for code completion and such in the local project.
    3. You retrieve Foo into the local project so that now you have Foo.cls in the OST and Foo.cls in the local project.
    4. You rename Foo to Bar and now you have Foo.cls in the OST, Bar.cls in the local project, and of course Bar in the org (but not Foo any longer).

    If after the third and/or fourth step you regenerate your OST, the version of Foo.cls in the OST will go away. It will go away after the third step because IC sees that you have Foo.cls locally and it doesn't need to generate a stub. It will go away after the fourth step because there is no longer a class named Foo in the org (it was renamed to Bar), and you have Bar.cls locally so that won't be included in the OST either.

    Based on what you're showing where the "ghost" of Foo is in the OST, it seems some variation of that issue may be happening to you. You may also be correct that this is happening due to branch switching, in particular if you've either checked in OfflineSymbolTable.zip and it's getting switched to an older version, or if by changing branches you're also changing connections and therefore connection-specific OfflineSymbolTable.zip files.

    Let me know if any of this doesn't make sense and/or doesn't seem to apply to you.

  4. Toni Garcia-Die reporter

    Hi Scott,

    Thank you very much for your answer, it looks to me you are pointing in the good direction, but bear in mind that the problem is not Foo.cls is showing, but Bar.cls is not. This is the annoying part of the bug as I have to search the class in the project list.

    Let me know if you find a solution, or at least a workaround for this.

    Best regards,

    Toni

  5. Toni Garcia-Die reporter

    Hi Scott,

    From your explanations I could see I needed to remove Foo.cls from my dev environment, so I did, and after rebuilding the OST, Foo.cls is not there anymore, but Bar.cls neither.

    Hope this helps to clarify what is happening.

    Thank you and regards,

    Toni

  6. Scott Wells repo owner

    Toni, do you have Bar.cls in your local project? If so, that's why Bar.cls isn't in the OST. Classes that are found locally are omitted from the OST because it's assumed that you're mastering those classes in your project. If you don't have it in the local project but the class is in fact in the org, that would be a bug. Is that the case?

  7. Toni Garcia-Die reporter

    Hi Scott,

    Thank you very much for your answer.

    Let me check we are in sync, Foo.cls was renamed to Bar.cls using rename refactoring.

    So yes, I do have Bar.cls in my project. I don't have Foo.cls in my local project as it does not exist anymore, now I just have Bar.cls.

    I do not fully understand your explanation about classes that are in my project and why they are omitted from OST, but the problem is Bar.cls does not show in the Navigate->File...

    Is then this a bug or not? And if not, what should I do to have Bar.cls showing then I use Navigate->File...

  8. Scott Wells repo owner

    Toni, good idea on level-setting as we've talked about a few things here. The initial issue seemed to be that after you renamed Foo to Bar, Foo was still showing up for navigation but Bar was not. Foo seemed to be showing up because it was also in your offline symbol table, and regenerating seemed to solve that. If you have Bar in your local project and it's not showing up for navigation, that's where we should focus now. If that's the case, please build your caches and indices one more time just to make sure that we're not dealing with a transient issue resulting from the way we've tried to diagnose this along the way. If Bar still isn't showing up after doing so, that's the problem we'll be investigating going forward.

  9. Toni Garcia-Die reporter

    Hi Scott,

    As requested, I have build caches and indices again, but the results are the same. The Foo.cls class that does not exist in local or remove does not show anymore, but the renamed Bar.cls class neither, I am afraid.

  10. Scott Wells repo owner

    Okay, and one more thing to rule out...can you verify that the file Bar.cls is in the same directory as classes that do show for navigation? I just want to make sure that it wasn't moved out of a source root or something like that.

  11. Toni Garcia-Die reporter

    Yes, class Bar.cls is in the same folder as all the other classes. And FYI this is not the only class that has this problem. Several classes were renamed, all are in the same folder and none of them show in the list when I hit Navigate->File...

  12. Scott Wells repo owner

    Thanks for confirming. And to characterize this more thoroughly, the classes which don't show up were all renamed, and the classes which have not been renamed do show up properly. Is that correct? Is there a very consistent rule for this? Hopefully once we get this characterized I'll either be able to reproduce it or I'll be able to provide a build with more debug logging that will help me see why this is happening in your project.

  13. Scott Wells repo owner

    Toni, I'm unable to reproduce this myself. I've attached a short video of me navigating to a class by name, renaming it, showing that I can no longer navigate to the old name but I can to the new name, and then renaming back and showing that the same still holds true properly.

    Are you doing something different than what I'm showing in that show video? If not, when this happens, do you see any exceptions in idea.log (Help>Show Log in Explorer/Finder/Files)? I'm trying to figure out what the difference might be since I'm not able to reproduce the issue.

  14. Toni Garcia-Die reporter

    Hi Scott,

    Thank you very much! I don't think I did something different from what you do, but I think Git and switching from branch to branch, some ones with the changes and other without (that is with the old names of the classes) messed the whole thing.

    I have checked Idea's log but all the entries are for today, and today I haven't switched to the failing branch. But I still have some exceptions. I have added the most obvious one just in case:

    javax.help.HelpSetException: Could not parse Got an IOException (C:\Program Files\JetBrains\IntelliJ IDEA 2018.1.4\help\ideahelp.jar (El sistema no puede encontrar el archivo especificado)) Parsing failed for null at javax.help.HelpSet.<init>(HelpSet.java:146) at com.intellij.help.impl.HelpManagerImpl.loadHelpSet(HelpManagerImpl.java:140) at com.intellij.help.impl.HelpManagerImpl.createHelpSet(HelpManagerImpl.java:114) at com.intellij.help.impl.HelpManagerImpl.invokeHelp(HelpManagerImpl.java:75) at com.android.tools.idea.help.StudioHelpManagerImpl.invokeHelp(StudioHelpManagerImpl.java:82) at com.intellij.ide.actions.HelpTopicsAction.actionPerformed(HelpTopicsAction.java:26) at com.intellij.openapi.actionSystem.ex.ActionUtil$1.run(ActionUtil.java:255) at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAware(ActionUtil.java:272) at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.lambda$actionPerformed$0(ActionMenuItem.java:304) at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:307) at com.intellij.openapi.wm.impl.IdeFocusManagerImpl.runOnOwnContext(IdeFocusManagerImpl.java:106) at com.intellij.openapi.actionSystem.impl.ActionMenuItem$ActionTransmitter.actionPerformed(ActionMenuItem.java:294) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022) at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$0(ActionMenuItem.java:114) at com.intellij.openapi.application.TransactionGuardImpl.runSyncTransaction(TransactionGuardImpl.java:88) at com.intellij.openapi.application.TransactionGuardImpl.lambda$submitTransaction$1(TransactionGuardImpl.java:111) at com.intellij.openapi.application.TransactionGuardImpl.submitTransaction(TransactionGuardImpl.java:120) at com.intellij.openapi.application.TransactionGuard.submitTransaction(TransactionGuard.java:122) at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:114) at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:529) at com.intellij.ui.plaf.beg.BegMenuItemUI.access$300(BegMenuItemUI.java:49) at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:549) at java.awt.Component.processMouseEvent(Component.java:6548) at javax.swing.JComponent.processMouseEvent(JComponent.java:3325) at java.awt.Component.processEvent(Component.java:6313) at java.awt.Container.processEvent(Container.java:2237) at java.awt.Component.dispatchEventImpl(Component.java:4903) at java.awt.Container.dispatchEventImpl(Container.java:2295) at java.awt.Component.dispatchEvent(Component.java:4725) at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889) at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526) at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467) at java.awt.Container.dispatchEventImpl(Container.java:2281) at java.awt.Window.dispatchEventImpl(Window.java:2746) at java.awt.Component.dispatchEvent(Component.java:4725) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764) at java.awt.EventQueue.access$500(EventQueue.java:98) at java.awt.EventQueue$3.run(EventQueue.java:715) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90) at java.awt.EventQueue$4.run(EventQueue.java:737) at java.awt.EventQueue$4.run(EventQueue.java:735) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:734) at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:781) at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:718) at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:382) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

    Text in Spanish says that the specified file could not be found.

  15. Scott Wells repo owner

    Thanks, Toni. That stack trace is unrelated unfortunately. That's just the base IDE saying that it couldn't find its online help file. However, that did shine a light on something important...you're running a much older version of the base IDE apparently. That log says you're running 2018.1.4 and the latest is 2018.2.5. Do you mind updating IntelliJ IDEA to the latest available and seeing if the same problem still occurs? There have been quite a few fixes to bugs in the base IDE that could potentially be coming into play here. I'd like to see if that helps resolve the issue or, if not, at least rules out a major version difference.

  16. Toni Garcia-Die reporter

    Hi Scott, yes I agree this point is important, but not so obvious, I have just run updates and got this Intellij updates.png

    According to Idea I have got the last version so I guess something went wrong with one of the updates...

    No ignored updates by the way.

    I guess if I should re-install the full package...

    Thank you very much Scott.

  17. Scott Wells repo owner

    Yeah, something weird there. Definitely let me know whether uninstalling/reinstalling the latest official build takes care of the issue or not.

  18. Log in to comment