I have some problems to compile my codes.
$ mvn clean compile
notify me like this kinds of errors.
[58,30] type parameters of <D,K>D cannot be determined; no unique maximal instance exists for type variable D with upper bounds DS,
Maybe this problem is caused by recursive bounds of generic types
. Right?
References: Generics compiles and runs in Eclipse, but doesn't compile in javac
How could I fix this one?
@SuppressWarnings("unchecked")
public static <D extends DataStore<K, T>, K, T extends Persistent> D createDataStore(Class<T> persistent, Properties properties) throws IOException {
try {
return (D) (new HBaseStore<K, T>());
} catch (Exception e) {
throw new RuntimeException("cannot initialize a datastore", e);
}
}
public static <DS extends DataStore<U, P>, U, P extends Persistent> DS createDataStore(Class<P> persistent) throws IOException {
return createDataStore(persistent, null); // ERROR
}