Buggy code:
public class MenuAdditionCacheEntry extends AbstractContributionFactory { private IConfigurationElement additionElement ; Map iciToConfigElementMap = new HashMap ( ) ; Set failedLoads = new HashSet ( ) ; private HashMap visWhenMap = new HashMap ( ) ; private IMenuService menuService ; public MenuAdditionCacheEntry ( IMenuService menuService , IConfigurationElement element , String location , String namespace ) { } private void generateSubCaches ( ) { } private Expression getVisibleWhenForItem ( IContributionItem item ) { } public void createContributionItems ( IServiceLocator serviceLocator , IContributionRoot additions ) { IConfigurationElement [ ] items = additionElement . getChildren ( ) ; for ( int i = 0 ; i < ( items . length ) ; i ++ ) { String itemType = items [ i ] . getName ( ) ; IContributionItem newItem = null ; if ( TAG_COMMAND . equals ( itemType ) ) { newItem = createCommandAdditionContribution ( serviceLocator , items [ i ] ) ; } else if ( TAG_DYNAMIC . equals ( itemType ) ) { newItem = createDynamicAdditionContribution ( items [ i ] ) ; } else if ( TAG_CONTROL . equals ( itemType ) ) { newItem = createControlAdditionContribution ( items [ i ] ) ; } else if ( TAG_SEPARATOR . equals ( itemType ) ) { newItem = createSeparatorAdditionContribution ( items [ i ] ) ; } else if ( TAG_MENU . equals ( itemType ) ) { newItem = createMenuAdditionContribution ( items [ i ] ) ; } else if ( TAG_TOOLBAR . equals ( itemType ) ) { newItem = createToolBarAdditionContribution ( items [ i ] ) ; } if ( newItem != null ) { iciToConfigElementMap . put ( newItem , items [ i ] ) ; <START_BUG> additions . addContributionItem ( newItem , getVisibleWhenForItem ( newItem ) , null ) ; <END_BUG> } } } private IContributionItem createToolBarAdditionContribution ( IConfigurationElement configurationElement ) { } private IContributionItem createMenuAdditionContribution ( final IConfigurationElement menuAddition ) { } private IContributionItem createSeparatorAdditionContribution ( final IConfigurationElement sepAddition ) { } private IContributionItem createDynamicAdditionContribution ( final IConfigurationElement dynamicAddition ) { } private IContributionItem createControlAdditionContribution ( final IConfigurationElement widgetAddition ) { } private IContributionItem createCommandAdditionContribution ( IServiceLocator locator , final IConfigurationElement commandAddition ) { } public static String getId ( IConfigurationElement element ) { } static String getName ( IConfigurationElement element ) { } static String getLabel ( IConfigurationElement element ) { } static String getTooltip ( IConfigurationElement element ) { } static String getIconPath ( IConfigurationElement element ) { } static String getDisabledIconPath ( IConfigurationElement element ) { } static String getHoverIconPath ( IConfigurationElement element ) { } static ImageDescriptor getIconDescriptor ( IConfigurationElement element ) { } static ImageDescriptor getDisabledIconDescriptor ( IConfigurationElement element ) { } static ImageDescriptor getHoverIconDescriptor ( IConfigurationElement element ) { } public static boolean isSeparatorVisible ( IConfigurationElement element ) { } public static String getClassSpec ( IConfigurationElement element ) { } public static String getCommandId ( IConfigurationElement element ) { } private int getStyle ( IConfigurationElement element ) { } public static Map getParameters ( IConfigurationElement element ) { } }

Fix:
additions . addContributionItem ( newItem , getVisibleWhenForItem ( newItem ) ) ;