Avoid unchecked assignment in a map with multiple value types?
问题 I'm having trouble with a warning in Java 7: Unchecked assignment: 'java.lang.Class' to 'java.lang.Class<T>' I'm getting it on the line Class<T> type = typeMap.get(key); in the get function below. Basically what I'm trying to do here is I want to store a bunch of key/value pairs of unknown types (but all are descendants of Object with the exception of null), but not lose the type. So I created a class with the following content using generics. It has two maps (one to store the data and one to