tags:

views:

171

answers:

2

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?

A: 

I believe you are looking for the jsr330.jar. It contains annotations like the javax.annotation.Nullable etc. Guava depends on this jar, and it visible in the Guava SVN repo.

gpampara
+2  A: 

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

Sylvain M