summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cpp/src/slice2java/Gen.cpp26
-rw-r--r--java/CHANGES6
2 files changed, 28 insertions, 4 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 8f8fd12a662..56735833de5 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -1568,10 +1568,28 @@ Slice::Gen::TypesVisitor::visitStructEnd(const StructPtr& p)
}
else
{
- out << nl << "if(!" << memberName << ".equals(_r." << memberName << "))";
- out << sb;
- out << nl << "return false;";
- out << eb;
+ //
+ // We treat sequences differently because the native equals() method for
+ // a Java array not perform a deep comparison, therefore we use the helper
+ // method java.util.Arrays.equals() instead.
+ //
+ // For all other types, we can use the native equals() method.
+ //
+ SequencePtr seq = SequencePtr::dynamicCast((*d)->type());
+ if(seq)
+ {
+ out << nl << "if(!java.util.Arrays.equals(" << memberName << ", _r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ }
+ else
+ {
+ out << nl << "if(!" << memberName << ".equals(_r." << memberName << "))";
+ out << sb;
+ out << nl << "return false;";
+ out << eb;
+ }
}
}
out << sp << nl << "return true;";
diff --git a/java/CHANGES b/java/CHANGES
index 1786efe46b4..76038cdb100 100644
--- a/java/CHANGES
+++ b/java/CHANGES
@@ -1,6 +1,12 @@
Changes since version 1.0.1
---------------------------
+- Changed the generated equals() method to use the helper
+ java.util.Arrays.equals() when comparing sequences, rather
+ than the native array equals() method. This means the equals()
+ method for a type containing a sequence member will perform
+ a deep comparison of the sequence.
+
- Added timestamps to the default Ice logger. You can enable
timestamps by setting the `Ice.Logger.Timestamp' property to a value
larger than zero. By default timestamps are disabled.