"}");
MenuBarInfo bar = getJavaInfoByName("bar");
IMenuPolicy policy = MenuObjectInfoUtils.getMenuInfo(bar).getPolicy();
// use "field initializer"
{
GenerationSettings generationSettings =
GwtToolkitDescription.INSTANCE.getGenerationSettings();
generationSettings.setVariable(FieldInitializerVariableDescription.INSTANCE);
}
// create new MenuItem
MenuItemInfo newItem = createJavaInfo("com.google.gwt.user.client.ui.MenuItem", "withSubMenu");
assertTrue(policy.validateCreate(newItem));
policy.commandCreate(newItem, null);