ProjectionSerializer generates files with warnings (unused import) #908

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

Comments

Projects
None yet
2 participants
@yrodiere

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 2, 2014

Member

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

Member

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

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Sep 30, 2014

Member

Released in 3.5.0

Member

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