Bug 256422 [DataBinding] doSetValue in WritableValue
I have redefined equals() and hashcode() method in my own Object. So two different instances (i1 and i2) can be equals. I create an WritableValue w initialize with i1. When I tried w.setValue(i2) and I get the value with w.getvalue(), i1 as returned instead of i2. DoSetValue in Writable value : public void doSetValue(Object value) { boolean changed = false; if (this.value == null && value != null) { changed = true; } else if (this.value != null && !this.value.equals(value)) { changed = true; } if (changed) { fireValueChange(Diffs.createValueDiff(this.value, this.value = value)); } } Can you change "!this.value.equals(value)" by "this.value != value ", please ?
bundles/org.eclipse.core.databinding/src/org/eclipse/core/databinding/observable/value/WritableValue.java
/*******************************************************************************
 * Copyright (c) 2006, 2007 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *     Brad Reynolds - bug 158687
 *     Brad Reynolds - bug 164653, 147515
 *******************************************************************************/
package org.eclipse.core.databinding.observable.value;
import org.eclipse.core.databinding.observable.Diffs;
import org.eclipse.core.databinding.observable.Realm;
/**
 * Mutable (writable) implementation of {@link IObservableValue} that will maintain a value and fire
 * change events when the value changes.
 * <p>
 * This class is thread safe. All state accessing methods must be invoked from
 * the {@link Realm#isCurrent() current realm}. Methods for adding and removing
 * listeners may be invoked from any thread.
 * </p>
 * @since 1.0
 */
public class WritableValue extends AbstractObservableValue {