I have some Guice binding code using generics that compiles and functions fine from Eclipse's compiler, but not from the Java (command-line) compiler. I upgraded to the latest (1.7.0_01) Java SDK but still get the following error.
[error] ...\BindCategorySelectorActivity.java:42: error: inconvertible types
[error] (Class<? extends ListAdapterDataProvider<Row<? extends DatabaseItem>>>) CategoryDataProvider.class);
[error] ^
[error] required: Class<? extends ListAdapterDataProvider<Row<? extends DatabaseItem>>>
[error] found: Class<CategoryDataProvider>
[error] 1 error
[error] {file:/.../compile:compile: javac returned nonzero exit code
Relevant code:
public interface Category extends DatabaseItem {}
public class CategoryDataProvider implements
ListAdapterDataProvider<Row<Category>> {}
public class BindListViewHandlerWithSpecificProvider extends AbstractModule {
public BindListViewHandlerWithSpecificProvider(
Class<? extends ListAdapterDataProvider<Row<? extends DatabaseItem>>>
dataProviderClass) {}
}
@SuppressWarnings("unchecked")
// Error happens here:
final BindListViewHandlerWithSpecificProvider
bindListViewHandlerWithSpecificProvider =
new BindListViewHandlerWithSpecificProvider(
(Class<? extends ListAdapterDataProvider<Row<? extends DatabaseItem>>>)
CategoryDataProvider.class);