我有以下代码:
public static <T extends User> void addUser(String username,
String passwordHash, Class<T> userClass, File usersDir) {
T user = (T) new User(username, passwordHash);
UserManager.toFile(user, usersDir);
}
Eclipse 给了我以下警告:
Type safety: Unchecked cast from User to T
如果我将T定义为扩展用户,为什么我会收到未检查的警告<T extends User>