mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-18 07:15:19 +00:00
Estimated hours taken: 2
Branches: main
Override Object#equals for Mercury enumerations in the Java grades
and document that this should be used for equality testing in Java
code. The problem with using == is that instances might not have
the same addresses if they are serialized and then deserialized.
MercuryEnum is now a class and not an interface.
compiler/ml_type_gen.m:
Inherit the MercuryEnum class in Mercury enumerations
instead of implementing the MercuryEnum interface.
compiler/mlds_to_java.m:
Don't output the MR_value member in Java classes that correspond to
Mercury enumerations. This member is now inherited from MercuryEnum.
Don't mangle classes in the Mercury runtime.
doc/reference_manual.texi:
Document that the equals method should be used for exported
Mercury enumerations.
java/runtime/MercuryEnum.java:
Make MercuryEnum a class and implement the equals method.
Also implement the hashcode method.