Abstract class "Tag" does not correctly override the equals() method from "Object"

Issue #22 new
Martn Wunderl created an issue

See discussion here: https://groups.google.com/forum/#!topic/okapi-devel/Chr4mcN0_gE

Implementations of equals() in CTag and MTag need to be changed, accordingly. Also, the equals() method should be added to TermTag. We should also override hashcode() (doing so is recommended in "Effective Java" whenever you override equals()).

Comments (3)

  1. Mihai Nita

    Merged, then reverted. Build failing, see https://gitlab.com/okapiframework/xliff-toolkit/-/jobs/128327028


    Tests run: 58, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 0.112 sec <<< FAILURE!
    testOwnTagsStatus(net.sf.okapi.lib.xliff2.core.FragmentTest)  Time elapsed: 0.001 sec  <<< ERROR!
    java.lang.NullPointerException
        at net.sf.okapi.lib.xliff2.core.CTag.hashCode(CTag.java:448)
        at java.util.HashMap.hash(HashMap.java:339)
        at java.util.HashMap.put(HashMap.java:612)
        at net.sf.okapi.lib.xliff2.core.Fragment.getOwnTagsStatus(Fragment.java:570)
        at net.sf.okapi.lib.xliff2.core.FragmentTest.testOwnTagsStatus(FragmentTest.java:1078)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        ...
    
  2. Martn Wunderl reporter

    @nmihai_2000 I am not able to reproduce the failed test locally. It also seems fine on the build system now. Could you verify? Might have been a temporary glitch. Tks.

  3. Log in to comment