Maven build throws IllegalStateException : Did not find type T in [] #368

Closed
martypitt opened this Issue Mar 18, 2013 · 2 comments

Comments

Projects
None yet
2 participants
@martypitt

My current build is throwing this exception when building from maven. (Building within Eclipse / STS works fine).

Here's the stack trace:

An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.IllegalStateException: Did not find type T in []
at com.mysema.query.codegen.TypeResolver.resolveVar(TypeResolver.java:79)
at com.mysema.query.codegen.TypeResolver.resolve(TypeResolver.java:44)
at com.mysema.query.codegen.TypeResolver.resolveWithParameters(TypeResolver.java:102)
at com.mysema.query.codegen.TypeResolver.resolve(TypeResolver.java:46)
at com.mysema.query.codegen.TypeResolver.resolveWithParameters(TypeResolver.java:102)
at com.mysema.query.codegen.TypeResolver.resolve(TypeResolver.java:46)
at com.mysema.query.codegen.Property.createCopy(Property.java:81)
at com.mysema.query.codegen.EntityType.include(EntityType.java:226)
at com.mysema.query.apt.AbstractQuerydslProcessor.addSupertypeFields(AbstractQuerydslProcessor.java:421)
at com.mysema.query.apt.AbstractQuerydslProcessor.processAnnotations(AbstractQuerydslProcessor.java:176)
at com.mysema.query.apt.AbstractQuerydslProcessor.process(AbstractQuerydslProcessor.java:112)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:627)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:556)
at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:701)
at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:987)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)

I've managed to track this down to reproducible using the following classes:

public interface Tradable {}

@Entity
public class FutureTrade implements Tradable {}

@MappedSuperclass
public abstract class AbstractTradingMarket<T extends Tradable> implements Market<T>{

    @OneToOne
    private TradingMarketLedger<AbstractTradingMarket<T>> ledger;
}

@Entity
public abstract class AbstractFuturesMarket extends AbstractTradingMarket<FutureTrade> {}

@Entity
public class CommonFuturesMarket extends AbstractFuturesMarket {}

@Entity
public class TradingMarketLedger<M extends Market<? extends Tradable>> {}

Interestingly, this code works fine through Eclipse.

It appears to be the nested generics within TradingMarketLedger plus some part of the type heirachy of the markets is causing the issue.

For example, if I remove CommonFuturesMarket, and make AbstractFuturesMarket not abstract, the code compiles.

ie:

@Entity  // This was AbstractFuturesMarket in earlier example
public class FuturesMarket extends AbstractTradingMarket<FutureTrade> {

However, if I then subclass FuturesMarket again, the error returns

@Entity
public class CommonFuturesMarket extends FuturesMarket {}

Here's my stack:

  • QueryDSL 2.9.0 (also tested under 2.7.x)
  • apt-maven-plugin 1.0.8 (also tested under 1.4.0)
  • STS 2.9.0

It's taken a looooong time to track this down, but I now have a small project that demos the example. Let me know if you need any other information.

Thanks

@martypitt

This comment has been minimized.

Show comment
Hide comment
@martypitt

martypitt Mar 18, 2013

I've created a gist with all the relevant files required to recreate a failing example.

https://gist.github.com/martypitt/5186137

I've created a gist with all the relevant files required to recreate a failing example.

https://gist.github.com/martypitt/5186137

timowest added a commit that referenced this issue Mar 18, 2013

timowest added a commit that referenced this issue Mar 18, 2013

@timowest

This comment has been minimized.

Show comment
Hide comment
@timowest

timowest Mar 21, 2013

Member

Released in 3.0.0

Member

timowest commented Mar 21, 2013

Released in 3.0.0

@timowest timowest closed this Mar 21, 2013

@timowest timowest added this to the 3.0.0 milestone Apr 14, 2014

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