Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

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

Vedenin opened this issue Oct 3, 2014 · 1 comment
Labels
bug
Milestone

Comments

@Vedenin
Copy link

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

Shredder121 added a commit that referenced this issue Oct 3, 2014
@timowest timowest added the bug label Oct 3, 2014
@timowest
Copy link
Member

@timowest 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

2 participants
You can’t perform that action at this time.