views:

401

answers:

2

Keep getting this error when compiling using Maven:

type parameters of <X>X cannot be determined; no unique maximal instance exists for type variable X with upper bounds int,java.lang.Object

Generics type interference cannot be applied to primitive types. But I thought since Java5, boxing/unboxing mechanism works seamlessly between primitive types and wrapper classes.

In any case, the strange thing is Eclipse doesn't report any errors and happily compiles. I'm using JDK1.6.0_12. What could possibly be the problem here?

+3  A: 

Check this thread for some enlighting in this issue.

pedromarce
+2  A: 

A few things to look at:

  1. Both Eclipse and Maven are using the same java/bin installation
  2. Eclipse and Maven are using the same libraries, one might have something the other does not.
Jay
I just realized that the compiler shipped with Eclipse isn't the same as Sun's official java compiler.
EnToutCas