Is it possible to generify an implementation of the interface if the interface definition does not use generics? I do not have control over the interface I need to implement, but would like to suppress “unchecked” warnings for my implementation.
Is it possible to generify an implementation of the interface if the interface definition
Share
Some issues can be resolved, some can not.
If the interface for instance looks like this:
then sure, you can implement it by
If, on the other hand, the interface looks something like
then there’s nothing you can do about it programming wise.
This is what is referred to as an unavoidable generic type problem. Luckily these warnings can be suppressed, at least in Eclipse, by checking Ignore unavoidable generic type problems under
Windows > Preferences > Java > Compiler > Errors/Warnings