[MENFORCER-227] Document nullability with @Nonnull on EnforcerRule API

git-svn-id: https://svn.apache.org/repos/asf/maven/enforcer/trunk@1663790 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/enforcer-api/pom.xml b/enforcer-api/pom.xml
index 63f23a0..0e35130 100644
--- a/enforcer-api/pom.xml
+++ b/enforcer-api/pom.xml
@@ -45,6 +45,12 @@
       <artifactId>plexus-container-default</artifactId>
       <version>1.0-alpha-9</version>
     </dependency>
+    <dependency>
+      <groupId>com.google.code.findbugs</groupId>
+      <artifactId>jsr305</artifactId>
+      <version>3.0.0</version>
+      <scope>provided</scope>
+    </dependency>
   </dependencies>
 
   <build>
diff --git a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule.java b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule.java
index f931e4c..18f1cfe 100644
--- a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule.java
+++ b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule.java
@@ -19,6 +19,9 @@
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
+
 /**
  * Interface to be implemented by any rules executed by the enforcer.
  *
@@ -40,7 +43,7 @@
      *
      * @throws EnforcerRuleException the enforcer rule exception
      */
-    void execute( EnforcerRuleHelper helper )
+    void execute( @Nonnull EnforcerRuleHelper helper )
         throws EnforcerRuleException;
 
     /**
@@ -61,7 +64,7 @@
      *
      * @return <code>true</code> if the stored results are valid for the same id.
      */
-    boolean isResultValid( EnforcerRule cachedRule );
+    boolean isResultValid( @Nonnull EnforcerRule cachedRule );
 
     /**
      * If the rule is to be cached, this id is used as part of the key. This can allow rules to take parameters
@@ -70,6 +73,7 @@
      * @return id to be used by the enforcer to determine uniqueness of cache results. The ids only need to be unique
      * within a given rule implementation as the full key will be [classname]-[id]
      */
+    @Nullable
     String getCacheId();
 
 }
diff --git a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule2.java b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule2.java
index 925534d..2b5f5d6 100644
--- a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule2.java
+++ b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRule2.java
@@ -19,6 +19,8 @@
  * under the License.
  */
 
+import javax.annotation.Nonnull;
+
 /**
  * Interface to be implemented by any rules as of version 2.0 executed by the enforcer.
  *
@@ -33,6 +35,7 @@
      *
      * @return level
      */
+    @Nonnull
     EnforcerLevel getLevel();
 
 }
diff --git a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java
index 24b3703..e75c0da 100644
--- a/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java
+++ b/enforcer-api/src/main/java/org/apache/maven/enforcer/rule/api/EnforcerRuleHelper.java
@@ -22,6 +22,8 @@
 import java.util.List;
 import java.util.Map;
 
+import javax.annotation.Nonnull;
+
 import org.apache.maven.plugin.logging.Log;
 import org.codehaus.plexus.PlexusContainer;
 import org.codehaus.plexus.component.configurator.expression.ExpressionEvaluator;
@@ -44,6 +46,7 @@
      *
      * @return the log
      */
+    @Nonnull
     Log getLog ();
 
     /**
@@ -55,6 +58,7 @@
      *
      * @throws ComponentLookupException the component lookup exception
      */
+    @Nonnull
     Object getComponent ( Class clazz )
         throws ComponentLookupException;
 
@@ -67,6 +71,7 @@
      *
      * @throws ComponentLookupException the component lookup exception
      */
+    @Nonnull
     Object getComponent ( String componentKey )
         throws ComponentLookupException;