5

I would like to use the javax.annotation.Nullable annotation in my GWT project. I would like to know which module has to be inherited into my gwt.xml file inorder to use that annotation. The google guava jar internally uses the Nullable annotation and If I use that Jar in my project it is able to compile. Please help me what package has to be inherited inorder to use the javax.annotation.Nullable annotation?

I have been searching on net for long time, but still unable to figure out which package has to be inherited.

Any suggestions would be appretiated.

Sarath Upadrista
  • 473
  • 4
  • 19

1 Answers1

1

You have to add a dependency on JSR 305. For example, Guava uses this:

<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>1.3.9</version>

Now, you have to use a workaround mentioned in a issue:

  1. Create a simple javax/annotation/Annotation.gwt.xml file in your project:

    <module>
        <source path="" />
    </module>
    
  2. Add <inherits name='javax.annotation.Annotation' /> to your applications module (.gwt.xml) file.

Igor Klimer
  • 15,321
  • 3
  • 47
  • 57