Guava r07, GWT and javax.annotation.Nullable

Evan Cowden picture Evan Cowden · Sep 27, 2010 · Viewed 15.2k times · Source

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:

import javax.annotation.Nullable;

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?

Answer

sly7_7 picture sly7_7 · Sep 27, 2010

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/lib where I see the @Nullable annotation