Avoid suppressing warnings around unchecked cast
We have the type object, so we might as well do an explicit cast.
@@ -90,10 +90,9 @@ public class DeserializationContext {
deserializer.registerInitialValue(initialValue);
}
- @SuppressWarnings("unchecked")
public <T> T getDependency(Class<T> type) {
Preconditions.checkNotNull(type);
- return (T) dependencies.get(type);
+ return type.cast(dependencies.get(type));
}
/**
