Files
mercury/java/runtime
Ian MacLarty 6aea768459 Override Object#equals for Mercury enumerations in the Java grades
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.
2009-09-22 07:16:38 +00:00
..