Generic methods בג'אווה
אני משחק קצת עם מתודות גנריות בג'אווה, אני מקבל הערה מעניינת שאני לא בדיוק יודע איך לסדר...
public <C extends Collection<V>, V> C readCollection(String path, Class<C> collectionType, Class<V> valueType)
זה הכותרת של המתודה, וזה הקריאה למתודה במהלך תוכנית
reader.readCollection("weights.model", new Vector<String>().getClass(), String.class);
אני מקבל את ההערה
Type safety: Unchecked invocation readCollection(String, Class<capture#1-of ? extends Vector>, Class<String>) of the generic method readCollection(String, Class<C>, Class<V>) of type JSONParsedFileHandler
אני כמובן יכול להתעלם ממנה...מצד שני הייתי רוצה לדעת ממה היא נובעת...יש רעיונות?
אני משחק קצת עם מתודות גנריות בג'אווה, אני מקבל הערה מעניינת שאני לא בדיוק יודע איך לסדר...
public <C extends Collection<V>, V> C readCollection(String path, Class<C> collectionType, Class<V> valueType)
זה הכותרת של המתודה, וזה הקריאה למתודה במהלך תוכנית
reader.readCollection("weights.model", new Vector<String>().getClass(), String.class);
אני מקבל את ההערה
Type safety: Unchecked invocation readCollection(String, Class<capture#1-of ? extends Vector>, Class<String>) of the generic method readCollection(String, Class<C>, Class<V>) of type JSONParsedFileHandler
אני כמובן יכול להתעלם ממנה...מצד שני הייתי רוצה לדעת ממה היא נובעת...יש רעיונות?