Action equality

I have a table where I have successfully enabled right-click menu Actions. In my handleAction method in the Action.Handler, I am finding that this test for action equality:

if (action == ACTION_EDIT)

or this one:

if ACTION_EDIT.equals(action)

does not work. Instead I have to use:

if (action.getCaption().equals(ACTION_EDIT.getCaption()))

Any ideas why the first test (which works in the vaadin demos) might not be working?


[code]

static final Action ACTION_EDIT = new Action("Edit");
static final Action ACTION_SAVE_CHANGE = new Action("Save Change");
static final Action ACTION_CANCEL = new Action("Cancel");
static final Action[] ACTIONS = new Action[]

{ACTION_EDIT,
ACTION_SAVE_CHANGE, ACTION_CANCEL};

	table_1.addActionHandler(new Action.Handler() {
		public Action[] getActions(Object target, Object sender) {
			return ACTIONS;
		}

		public void handleAction(Action action, Object sender, Object target) {
			//if (action.getCaption().equals(ACTION_EDIT.getCaption())) {
			if (action == ACTION_EDIT) {
				table_1.makeARowEditable(table_1.getItem(target));
				table_1.requestRepaint();
			} else if (ACTION_SAVE_CHANGE.equals(action)) {

				table_1.requestRepaint();
			} else if (ACTION_CANCEL.equals(action)) {
				table_1.makeARowEditable(null);
			}
		}
	})

[/code];

I think its caused by serialization and deserialization of the application state. This gives different instances, that use the default Object.equals().
I extended action, generate random field and overidden equals to use this field to compare instances. Works for me.