Yes. As I see it by removing the #if statement the recursion gets one step deeper and executes the displayMenu() method even for the last items in the tree. By having that #if statement the last items (the ones having $menu.components.size() == 0) will not be checked over the
statement in the next recursion step, but just be added right away. For those "last" items the #if statement on line 3 will return false (since they don't have any children), so the #menuItem($menu $level) statement on line 13 will add them to the menu (but only if the #if statement on line 2 already returned true, which means the user is allowed to see the menu item).
01: #macro( displayMenu $menu $level )
02: #if ($displayer.isAllowed($menu))
03: #if ($menu.components.size() > 0)
04: ## display top menu
05: #menuItem($menu $level)
06: #foreach ($menu in $menu.components)
07: #local ($menu $level)
08: #set ($level = $level+1)
09: #eval("#displayMenu($menu $level)")
13: #menuItem($menu $level)
(sorry but I didn't find out how to indent the lines properly)
I can imagine that you probably don't want to put code into your project if you're not a 100% sure of if it is error prone. Unfortunately I only had one project in which I had to use struts-menu and I don't have that code handy right now Actually, you should be able to reproduce the behavior I experienced quite easily as soon as you do a test with a PermissionAdapter and require some permissions for the last items in the tree.
However, if somebody else has problems with permissions on the last items they can just put that menuMacros.vm file into the root source folder which should overwrite the code of globalMacros.vm in the package (if I got that right). And in that case you don't have to change your code at all
p.s. I'm sorry if my english sounds billowed (I'm not native speaker