当前位置: 代码迷 >> J2SE >> 关于◎SuppressWarnings("Unchecked"),该怎么解决
  详细解决方案

关于◎SuppressWarnings("Unchecked"),该怎么解决

热度:556   发布时间:2016-04-24 17:46:24.0
关于◎SuppressWarnings("Unchecked")
package   net.sf.hibernate.examples.quickstart;  
import   org.apache.commons.logging.Log;  
import   org.apache.commons.logging.LogFactory;  
import   net.sf.hibernate.*;  
import   net.sf.hibernate.cfg.*;  
◎SuppressWarnings( "Unchecked ")
public   class   HibernateUtil{  
private   static   Log  

log=LogFactory.getLog(HibernateUtil.class);  

private   static   final   SessionFactory   sessionFactory;  
static{  
try{  
sessionFactory=new   Configuration().configure().buildSessionFactory();  
}  
catch(Throwable   ex){  
log.error( "Initial   SessionFactory   creation   failed. ",ex);  
throw   new   ExceptionInInitializerError(ex);  
}  
}  
public   static   final   ThreadLocal   session=new   ThreadLocal();
◎SuppressWarnings( "Unchecked ")  
public   static   Session   currentSession()   throws   HibernateException{  
Session   s=(Session)session.get();  
if(s==null){  
s=sessionFactory.openSession();  
session.set(s);  
}  
return   s;  
}  
◎SuppressWarnings( "Unchecked ")
public   static   void   closeSession()   throws   HibernateException{  
Session   s=(Session)session.get();  
session.set(null);  
if(s!=null)  
s.close();  
}  
}  
我用了◎SuppressWarnings( "Unchecked ")这个啊   为什么编译器还报  
"使用了未经检查或不安全的操作 "


------解决方案--------------------
不用理会
  相关解决方案