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

ProjectionSerializer generates files with warnings (unused import) #908

Closed
yrodiere opened this issue Aug 25, 2014 · 2 comments
Closed

ProjectionSerializer generates files with warnings (unused import) #908

yrodiere opened this issue Aug 25, 2014 · 2 comments
Milestone

Comments

@yrodiere
Copy link

@yrodiere yrodiere commented Aug 25, 2014

When using only the @QueryProjection feature on a class, like this :

public class MyProjection {
 private final int data;

 @QueryProjection
 public MyProjection(int data) {
  this.data = data;
 }
}

The generated code includes an unused import : import com.mysema.query.types.expr.*; along with 3 other (used) imports :

import com.mysema.query.types.expr.*;

import com.mysema.query.types.Expression;
import com.mysema.query.types.ConstructorExpression;
import javax.annotation.Generated;

This is probably related to issue #697: since this fix was applied, the constructor parameters may be only generic com.mysema.query.types.Expression<T> and not specific com.mysema.query.types.expr.NumberExpression<Integer>.

A quick fix would be to add @SuppressWarnings("all") on every generated class, as I've seen done on other code generation tools. It's probably not very elegant, but the developers rarely care about warnings on generated code, since they can't do a thing about that anyway.

Thanks.

@timowest
Copy link
Member

@timowest timowest commented Sep 2, 2014

Thanks for the issue! I added now a PR which adds the Expression import only when needed.

@timowest timowest added this to the 3.5.0 milestone Sep 2, 2014
@timowest timowest closed this in #922 Sep 3, 2014
@timowest
Copy link
Member

@timowest timowest commented Sep 30, 2014

Released in 3.5.0

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.