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

Closed
Vedenin opened this Issue Oct 3, 2014 · 1 comment

Comments

Projects
None yet
2 participants
@Vedenin

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).

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Oct 3, 2014

Member

I added an alternative fix which might be clearer.

Member

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