The bug in com.mysema.query.DefaultQueryMetadata.equals() method #981

Vedenin opened this Issue Oct 3, 2014 · 1 comment


None yet
2 participants

Vedenin commented Oct 3, 2014

Hi, All

If you run this code (in version from 3.0 to 3.5):

    DefaultQueryMetadata meta = new DefaultQueryMetadata();
    meta.addJoin(JoinType.DEFAULT, new ConstantImpl<String>("1"));
    System.out.println("Test = " + meta.equals(meta.clone()));

You must see "Test = false", because in DefaultQueryMetadata.equals() using code:
"... && q.getJoins().equals(joins)", but since version 3.0 method getJoins() returns joinTarget if joins.size()==0 (getJoins() { addLastJoin(); return joins; }, and q.getJoins().equals(joins) == false for some object (if joins.size()==0). I think, it's quite serious bug. However, it can be fixed, only if using q.getJoins().equals(getJoins()) instead of q.getJoins().equals(joins).


This comment has been minimized.

Show comment
Hide comment

timowest Oct 3, 2014


I added an alternative fix which might be clearer.


timowest commented Oct 3, 2014

I added an alternative fix which might be clearer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment