I have the following classes:
public class EntityDataModel<T extends AbstractEntity> { ... } public abstract class BarChartBean<E extends ChartEntry, T> { protected EntityDataModel<? extends T> currentModel; ... }
I can compile and run this code on eclipse without problems, but when I call mvn compile , this error occurs:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project edea2: Compilation failure: Compilation failure: [ERROR] C:\Develop\...\BarChartBean.java:[53,30] error: type argument ? extends T#1 is not within bounds of type-variable T#2 [ERROR] where T#1,T#2 are type-variables: [ERROR] T#1 extends Object declared in class BarChartBean [ERROR] T#2 extends AbstractEntity declared in class EntityDataModel
The error is pretty clear, and, theoretically, javac is right, and the eclipse compiler is wrong.
Why is there such a difference?
Here you will find environmental information:
Eclipse
- Release Mars.2 (4.5.2)
- jdk 1.8.0_71
- Compiler Compliance Level: 1.8

Maven
Question How can I align the behavior of the eclipse compiler with javac (but I do not want to use javac in eclipse)?
java eclipse maven maven-3 maven-compiler-plugin
Michele mariotti
source share