Source:
<code>private void processDynamicElements(final MenuManager menuManager, Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { @Override public void run() { <START> final Map<MDynamicMenuContribution, ArrayList<MMenuElement>> toBeHidden = new HashMap<MDynamicMenuContribution, ArrayList<MMenuElement>>(); <END> for (MMenuElement currentMenuElement : menuModel.getChildren()) { if (currentMenuElement instanceof MDynamicMenuContribution) { final Map<String, Object> storageMap = currentMenuElement.getTransientData(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) storageMap .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); toBeHidden.put((MDynamicMenuContribution) currentMenuElement, mel); if (mel != null && mel.size() > 0) { for (MMenuElement item : mel) { item.setVisible(false); } } currentMenuElement.getTransientData() .remove(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); } } for (Entry<MDynamicMenuContribution, ArrayList<MMenuElement>> entry : toBeHidden.entrySet()) { MDynamicMenuContribution currentMenuElement = entry.getKey(); Object contribution = currentMenuElement.getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory.create(); ArrayList<MMenuElement> mel = entry.getValue(); dynamicMenuContext.set(List.class, mel); IEclipseContext parentContext = modelService.getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, parentContext, dynamicMenuContext, null); dynamicMenuContext.dispose(); if (mel != null && mel.size() > 0) { renderer.removeDynamicMenuContributions(menuManager, menuModel, mel); } } } }); } }</code><technical_language>Remove redundant type info</technical_language>

Target:
private void processDynamicElements(final MenuManager menuManager, Menu menu, final MMenu menuModel) { if (!menu.isDisposed()) { menu.getDisplay().asyncExec(new Runnable() { @Override public void run() { final Map<MDynamicMenuContribution, ArrayList<MMenuElement>> toBeHidden = new HashMap<>(); for (MMenuElement currentMenuElement : menuModel.getChildren()) { if (currentMenuElement instanceof MDynamicMenuContribution) { final Map<String, Object> storageMap = currentMenuElement.getTransientData(); @SuppressWarnings("unchecked") ArrayList<MMenuElement> mel = (ArrayList<MMenuElement>) storageMap .get(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); toBeHidden.put((MDynamicMenuContribution) currentMenuElement, mel); if (mel != null && mel.size() > 0) { for (MMenuElement item : mel) { item.setVisible(false); } } currentMenuElement.getTransientData() .remove(MenuManagerShowProcessor.DYNAMIC_ELEMENT_STORAGE_KEY); } } for (Entry<MDynamicMenuContribution, ArrayList<MMenuElement>> entry : toBeHidden.entrySet()) { MDynamicMenuContribution currentMenuElement = entry.getKey(); Object contribution = currentMenuElement.getObject(); IEclipseContext dynamicMenuContext = EclipseContextFactory.create(); ArrayList<MMenuElement> mel = entry.getValue(); dynamicMenuContext.set(List.class, mel); IEclipseContext parentContext = modelService.getContainingContext(currentMenuElement); ContextInjectionFactory.invoke(contribution, AboutToHide.class, parentContext, dynamicMenuContext, null); dynamicMenuContext.dispose(); if (mel != null && mel.size() > 0) { renderer.removeDynamicMenuContributions(menuManager, menuModel, mel); } } } }); } }