No error message when a getter is referenced on the page and is not present in the controller

Issue #387 resolved
Paweł Hajduk created an issue

On the page I have a method getTypes() referenced but I deleted it from the controller and now I can't compile my controller. No error message is shown in the IDE. But when I go to Setup > Apex Classes and do a quick save on the controller I get the message:

Error: Compile Error: The method List<System.SelectOption> getTypes() is referenced by Visualforce Page (<controller_name>) in salesforce.com. Remove the usage and try again. at line 184 column 28    

Please add support for that kind of errors because it may be confusing if deployment lasts about 10 minutes and still doesn't give any result.

Steps to reproduce:

  1. Create a getter method in the controller
  2. Reference created method on the page
  3. Commit changes
  4. Remove method from the controller
  5. Remove reference from the page
  6. Deploy from SVN trunk using Bamboo (the code with the getter method still present)
  7. Try to save the controller from the local version (without getter method)

Comments (6)

  1. Scott Wells repo owner

    Pawel, let me try to reproduce and see what's coming back from the API in the way of errors. As long as I'm getting something back, I'll make sure it gets associated with the original source file.

    As for 10 minute deployments, are you using the Tooling API? There are known performance issues with deployments via the Metadata API in many orgs, but the Tooling API should be considerably faster. Please look under Settings>Illuminated Cloud>Validation and Deployment and make sure that the items are Prefer Tooling API for are checked, then see if the deployment times are improved. Note that the Tooling API will only be used when it supports deployment of the requested file(s). That means single file or batch deployments of Apex/Visualforce and single file deployments of static resources and Lightning bundle contents.

    I'll let you know what I find on the missing error message.

  2. Scott Wells repo owner

    Pawel, I'm having trouble reproducing this one. First let me make sure I'm following analogous steps since I don't have SVN/Bamboo in my environment. Here's what I'm doing:

    1. Add a controller method public String getIssue387() { return 'Issue387'; }. Save the controller.
    2. Create a reference in the page that uses that controller, {!issue387}. Save the page.
    3. Remove getIssue387() from the controller (I'm just commenting it out). Do not save the controller.
    4. Remove the reference in the page (I've tried commenting out and fully removing it). Do not save the page.
    5. Try to save the controller that no longer contains the referenced method.

    For better or worse, the last step does succeed. This is because Salesforce doesn't perform a transitive rebuild when a dependency is updated, in this case a class that's referenced by a page. The same thing happens if you follow these steps with two Apex classes where one references a method in the other that is then removed and saved. You do see an error if you then try to save the dependent metadata with the dangling reference, and you also see an error if you try to deploy the two together in a single request (in the steps above, you wouldn't remove the reference from the page), in this case the error I get back is Unknown property 'MyController.issue387'.

    Can you let me know what you're doing that's different from what I'm doing, ideally with steps that reproduce it without the need for SVN and Bamboo? Thanks much!

  3. Scott Wells repo owner

    Resolving due to lack of activity on the ticket. If this is still a problem, please feel free to reopen with explicit steps to reproduce and I'll take a look.

  4. Log in to comment