The following code compiles in JDK6. Fails in JDK7 with compilation error.
java: incompatible types
required: com.jdk7.IExporter<O>
found: com.jdk7.IExporter<java.lang.Object>
Compiler is 1.7.0_10, from Oracle.
$ javac -version
javac 1.7.0_10
Code
package com.jdk7;
public class GenericIn7 {
public <O> IExporter<O> getExporter(Class<O> objType) {
final IExporter<O> localExporter =
determineExporter(getPersistentInterface(objType));
return null;
}
private <O> IExporter<O> determineExporter(Class<O> persistentInterface) {
return null;
}
protected <O, I extends O> Class<O> getPersistentInterface(Class<I> clazz) {
return null;
}
}
class IExporter<T> {
}
[For sake of completeness, replacing generic with IExporter and other changes make it compile. ]