I wrote some Visualforce code earlier this week that referenced a List's empty method as follows:

<apex:outputText value="No values" rendered="{!myListVar.empty}"/>

It was working all this week and now, after the Winter '13 upgrade, I get an error:

Unknown property 'List.empty'

Error is in expression '{!myListVar.empty}' in component <apex:outputText> in page myPage

I can still reference the empty method of a List in this manner from Visualforce in my DE on na14 (Summer '12), but in the sandbox on cs9 (Winter '13) I get the error.

I can access the size method without any problems:

<apex:outputText value="{!myListVar.size}"/>

However, if I change that exact line of code to:

<apex:outputText value="{!myListVar.empty}"/>

I get the error.

The strange part is that I can save the file just fine without errors. It is a run time exception.

It is not the following:

<!-- Note the *is*. I changed it to this just to test it out --> 
<apex:outputText value="{!myListVar.isEmpty}"/>

which when I save in the Development Mode Visualforce Editor (i.e., bottom of the browser window editor), I get:

Error: Unknown property 'VisualforceArrayList.isempty'

The page was originally API version 24, but I've tried it in 23, 24, 25, and 26 and all do not work on my Winter '13 sandbox.

Has the ability to use the empty method of a List been removed with the Winter '13 release? I didn't see this in the Winter '13 release notes. Is there documentation outside of the release notes on changes to the Visualforce processor/renderer?

  • 1
    Did the API version of your page change? If not, then I don't think it could be a Winter '13 issue since your page would still be living life back in Summer '12. I've never used .empty, however. I always went with .size
    – Tim Smith
    Commented Sep 8, 2012 at 17:47
  • @TimSmith - Good thought. Oddly enough the page with problems is API version 24.0. I changed it to 25 and 26 to test that, but no luck. It's not a huge deal since I just changed it to use size. It was just strange when all of a sudden the page gave me that error w/o me changing anything on it. I know that stuff changes with Visualforce in releases but I didn't see this mentioned anywhere. Commented Sep 8, 2012 at 18:08
  • Weird - I've posted this internally to see if it might be a regression, or if there's another explanation...
    – metadaddy
    Commented Sep 10, 2012 at 15:47

2 Answers 2


I just verified that in both API 24.0 and 25.0 it works fine for me.

public List<String> testEmpty {get; set;}

<apex:outputText value="test" rendered="{!(testEmpty.empty)}"/>

Doesn't render "test" on the page, but when I initialize the list in the constructor:

public GenericController()
   testEmpty = new List<String>();

It renders as expected. On a side note, I do prefer to be explicit with booleans to avoid unexpected null conditions (testEmpty.empty == true).

Although you can easily work around this issue, it's an interesting thing to run into. Assuming you're not talking about custom iterators, which could conceivably introduce naming issues, and barring an actual bug in your org instance, I have no idea what could be happening.

  • Thanks for looking into it! I'm not sure what's going on. I can access the size method just fine, so I've changed my rendered logic to myListVar.size == 0 or myListVar.size > 0 I have no problems. Commented Sep 9, 2012 at 3:34
  • Works now...not sure what happened. Had a page that was erring out, no changes, and now fine. Commented Oct 20, 2012 at 1:28
  • It happens... ;)
    – Adam
    Commented Oct 20, 2012 at 5:12

Lists (and other variables) must be initialized. The testEmpty list with just get/set is actually null, and thus is not empty. It doesn't exist yet. You just made a placeholder for where the list will go. Once you initialize the list in the constructor, the page can access the existing (though empty) list and act appropriately.

  • Do you mean this to be a comment to Adam's post? I don't think this is an answer to my question. Also, Adam's post actually creates the List in the constructor... Commented Sep 9, 2012 at 3:28
  • Maybe it is a comment to his post; I'm not sure if it's best as a comment to that or an explanation of why your code may not work, expanding on his base. Whatever the reason, I hope the explanation of why the constructor initialization is necessary helped. Commented Sep 9, 2012 at 4:20
  • It makes sense. Thanks for posting. StackExchange is a little different than the SF boards or other forums so it takes some getting used to. There is an add comment link under each answer that you can use to comment. Again, thanks for using SFSE and I hope you continue to use it. :) Commented Sep 9, 2012 at 12:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .