本文介绍了Guava r07,GWT和javax.annotation.Nullable的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在没有成功的GWT项目中使用Guava(准确地说是一个HashMultimap)。我得到了一个类的堆栈跟踪永无止境的列表:




  • com.google.common.collect.ComparisonChain

  • com.google.common.collect.ForwardingSortedSetMultimap

  • com.google.common.collect.Ordering

  • ...
  • >


每个堆栈跟踪如下:


  • line xx:无法解析导入的javax.annotation

  • 行xx:可为空的不能解析为类型
  • 行xx:可为空的不能为解析为类型

  • 行xx:可为空的不能解析为类型

  • ...

>

查看代码,每个引发错误的文件都包括:

,看着guava-src-r07.jar,每个提到的类都使用@Nullable注解。 / p>

我正在使用JDK6并查看JDK6 javadoc以及...呃,我不能d任何此类注释。我可以让这些库使用GWT项目和JDK6吗?



- 你在那里使用什么版本的Java?

解决方案

嗡嗡声...我想这是你要找的jsr305 。看看



这里一定比较好:
其中I请参阅@Nullable注释


I'm trying to use Guava in a GWT project without success (a HashMultimap, to be precise). I get a never-ending list of stacktraces for classes:

  • com.google.common.collect.ComparisonChain
  • com.google.common.collect.ForwardingSortedSetMultimap
  • com.google.common.collect.Ordering
  • ...

Each stack trace is along the lines of:

  • line xx: the import javax.annotation cannot be resolved
  • line xx: Nullable cannot be resolved to a type
  • line xx: Nullable cannot be resolved to a type
  • line xx: Nullable cannot be resolved to a type
  • ...

Looking at the code, each file that throws an error includes:

and, looking at the guava-src-r07.jar, each mentioned classes uses a @Nullable annotation.

I'm using JDK6 and looking at the JDK6 javadoc and...well, I can't find any such annotation. Can I get these libraries to work with a GWT project and JDK6?

P.S. - What version of Java are you using over there?

解决方案

Hum... I think it's the jsr305 you're looking for. Take a look at

http://www.findjar.com/jar/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar.html

It must be better here: http://code.google.com/p/guava-libraries/source/browse/#svn/trunk/libwhere I see the @Nullable annotation

这篇关于Guava r07,GWT和javax.annotation.Nullable的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-02 01:06