2010-11-09 63 views
0

我只是無法理解這一點。 我打電話org.hibernate.SessionFactory的getAllClassMetadata()實例方法未經檢查的泛型使用警告

AnnotationConfiguration annotationConfiguration = new AnnotationConfiguration(); 
SessionFactory sessionFactory = annotationConfiguration.configure().buildSessionFactory(); 
Map<?, ?> allClassMetadata = sessionFactory.getAllClassMetadata(); 

好了,我沒有警告的唯一途徑是,如果我使用通配符?但是!如果我在SessionFactory接口或其任何實現中查看getAllClassMetadata()方法的定義,則返回類型爲Map<String,ClassMetadata>。所以,問題是。當我寫

Map<String,ClassMetadata> allClassMetadata = sessionFactory.getAllClassMetadata(); 

Eclipse告訴我The expression of type Map needs unchecked conversion to conform to Map<String,ClassMetadata>我只是不明白這一點。這是愚蠢的。請幫忙。

+0

? – 2010-11-09 09:51:22

+0

對不起,我的錯,我用了一些沒有參數化的舊版本的hibernate,並附加了新版本的源碼,因此我在想什麼和真正的有什麼區別。 – dhblah 2010-11-09 09:55:48

回答

相關問題