2014-11-14 111 views
1

我使用guava-18.0java1.6错误得到

下面给出的代码的专用域名:

String host = null; 
host = new URI(this.domain).getHost(); 
     Pattern p = Pattern.compile("[a-zA-Z]"); 
     Matcher m = p.matcher(host); 
     if(m.find()){ 
      InternetDomainName domainName = InternetDomainName.from(host); 
      this.domain = domainName.topPrivateDomain().name(); 
      System.out.println(this.domain); 
     } 
     else 
      this.domain = host; 

当运行Ant来构建,它给出了这样的错误消息:

[javac] symbol : method name() 
[javac] location: class com.google.common.net.InternetDomainName 
[javac]        this.domain = domainName.topPrivateDomain().name(); 
[javac]                  ^
[javac] Note: Some input files use unchecked or unsafe operations. 
[javac] Note: Recompile with -Xlint:unchecked for details. 
[javac] 1 error 

方法topPrivateDomain返回一个InternetDomainName对象,它确实有一个名为name()的方法。有什么问题?

回答