Skip to content

Commit 03999dc

Browse files
committed
Updated Reference::equals to use Object::equals (OMG Issue FUML13-26).
1 parent 8408a05 commit 03999dc

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

org.modeldriven.fuml/src/main/java/fUML/Semantics/Classes/Kernel/Object_.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,13 @@ public fUML.Semantics.Classes.Kernel.Value copy() {
118118
return newObject;
119119

120120
} // copy
121+
122+
public boolean equals(Value otherValue) {
123+
// Test if this object is equal to the otherValue.
124+
// To be equal, the otherValue must be the same object as this object.
125+
126+
return this == otherValue;
127+
} // equals
121128

122129
protected fUML.Semantics.Classes.Kernel.Value new_() {
123130
// Create a new object with no type, feature values or locus.

org.modeldriven.fuml/src/main/java/fUML/Semantics/Classes/Kernel/Reference.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ public boolean equals(fUML.Semantics.Classes.Kernel.Value otherValue) {
6161

6262
boolean isEqual = false;
6363
if (otherValue instanceof Reference) {
64-
isEqual = (((Reference) otherValue).referent == this.referent);
64+
if (this.referent == null) {
65+
isEqual = ((Reference)otherValue).referent == null;
66+
} else {
67+
isEqual = this.referent.equals(((Reference) otherValue).referent);
68+
}
6569
}
6670

6771
return isEqual;

0 commit comments

Comments
 (0)