Update getAbiKey() and getAbiKeyForDeps() to return non-null values instead of Optional.

Test Plan: Sandcastle builds.
diff --git a/src/com/facebook/buck/java/DefaultJavaLibraryRule.java b/src/com/facebook/buck/java/DefaultJavaLibraryRule.java
index 494b07f..cbdb219 100644
--- a/src/com/facebook/buck/java/DefaultJavaLibraryRule.java
+++ b/src/com/facebook/buck/java/DefaultJavaLibraryRule.java
@@ -23,12 +23,12 @@
 import com.facebook.buck.android.UberRDotJavaUtil;
 import com.facebook.buck.graph.TopologicalSort;
 import com.facebook.buck.java.abi.AbiWriterProtocol;
-import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.model.BuildTargetPattern;
 import com.facebook.buck.rules.AbiRule;
 import com.facebook.buck.rules.AbstractBuildRuleBuilder;
 import com.facebook.buck.rules.AbstractBuildRuleBuilderParams;
+import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.rules.BuildContext;
 import com.facebook.buck.rules.BuildDependencies;
 import com.facebook.buck.rules.BuildRule;
@@ -362,7 +362,7 @@
    * lacks an ABI key, then returns {@link Optional#absent()}.
    */
   @Override
-  public Optional<Sha1HashCode> getAbiKeyForDeps() throws IOException {
+  public Sha1HashCode getAbiKeyForDeps() throws IOException {
     SortedSet<JavaLibraryRule> rulesWithAbiToConsider = Sets.newTreeSet();
     for (BuildRule dep : getDeps()) {
       if (dep instanceof JavaLibraryRule) {
@@ -377,14 +377,11 @@
         continue;
       }
 
-      Optional<Sha1HashCode> abiKey = ruleWithAbiToConsider.getAbiKey();
-      if (!abiKey.isPresent()) {
-        return Optional.absent();
-      }
-      hasher.putUnencodedChars(abiKey.get().getHash());
+      Sha1HashCode abiKey = ruleWithAbiToConsider.getAbiKey();
+      hasher.putUnencodedChars(abiKey.getHash());
     }
 
-    return Optional.of(new Sha1HashCode(hasher.hash().toString()));
+    return new Sha1HashCode(hasher.hash().toString());
   }
 
   @Override
@@ -571,7 +568,7 @@
     });
 
     buildableContext.addMetadata(ABI_KEY_FOR_DEPS_ON_DISK_METADATA,
-        getAbiKeyForDeps().get().getHash());
+        getAbiKeyForDeps().getHash());
   }
 
   /**
@@ -681,10 +678,10 @@
   }
 
   @Override
-  public Optional<Sha1HashCode> getAbiKey() {
+  public Sha1HashCode getAbiKey() {
     Preconditions.checkState(isRuleBuilt(),
         "%s must be built before its ABI key can be returned.", this);
-    return Optional.fromNullable(abiKeySupplier == null ? null : abiKeySupplier.get());
+    return abiKeySupplier.get();
   }
 
   private void setAbiKey(Supplier<Sha1HashCode> abiKeySupplier) {
diff --git a/src/com/facebook/buck/java/JavaLibraryRule.java b/src/com/facebook/buck/java/JavaLibraryRule.java
index b74026f..7d971fb 100644
--- a/src/com/facebook/buck/java/JavaLibraryRule.java
+++ b/src/com/facebook/buck/java/JavaLibraryRule.java
@@ -20,7 +20,6 @@
 import com.facebook.buck.rules.BuildRule;
 import com.facebook.buck.rules.Buildable;
 import com.facebook.buck.rules.Sha1HashCode;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSetMultimap;
 import com.google.common.collect.ImmutableSortedSet;
 
@@ -60,9 +59,6 @@
    * <p>
    * Because the ABI is computed as part of the build process, this rule cannot be invoked until
    * after this rule is built.
-   * <p>
-   * Returns {@link Optional#absent()} if the rule did not build successfully, or if the ABI could
-   * not be extracted for any reason.
    */
-  public Optional<Sha1HashCode> getAbiKey() throws IOException;
+  public Sha1HashCode getAbiKey() throws IOException;
 }
diff --git a/src/com/facebook/buck/java/PrebuiltJarRule.java b/src/com/facebook/buck/java/PrebuiltJarRule.java
index a22b2eb..5c16f21 100644
--- a/src/com/facebook/buck/java/PrebuiltJarRule.java
+++ b/src/com/facebook/buck/java/PrebuiltJarRule.java
@@ -18,18 +18,18 @@
 
 import static com.facebook.buck.rules.BuildableProperties.Kind.LIBRARY;
 
-import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.model.BuildTargetPattern;
 import com.facebook.buck.rules.AbstractBuildRuleBuilder;
 import com.facebook.buck.rules.AbstractBuildRuleBuilderParams;
-import com.facebook.buck.rules.BuildableContext;
-import com.facebook.buck.rules.DoNotUseAbstractBuildable;
+import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.rules.BuildContext;
 import com.facebook.buck.rules.BuildRuleParams;
 import com.facebook.buck.rules.BuildRuleResolver;
 import com.facebook.buck.rules.BuildRuleType;
+import com.facebook.buck.rules.BuildableContext;
 import com.facebook.buck.rules.BuildableProperties;
+import com.facebook.buck.rules.DoNotUseAbstractBuildable;
 import com.facebook.buck.rules.RuleKey;
 import com.facebook.buck.rules.Sha1HashCode;
 import com.facebook.buck.step.Step;
@@ -122,8 +122,8 @@
   }
 
   @Override
-  public Optional<Sha1HashCode> getAbiKey() throws IOException {
-    return Optional.of(new Sha1HashCode(getRuleKey().toString()));
+  public Sha1HashCode getAbiKey() throws IOException {
+    return new Sha1HashCode(getRuleKey().toString());
   }
 
   @Override
diff --git a/src/com/facebook/buck/rules/AbiRule.java b/src/com/facebook/buck/rules/AbiRule.java
index 11dc81d..36ac744 100644
--- a/src/com/facebook/buck/rules/AbiRule.java
+++ b/src/com/facebook/buck/rules/AbiRule.java
@@ -16,8 +16,6 @@
 
 package com.facebook.buck.rules;
 
-import com.google.common.base.Optional;
-
 import java.io.IOException;
 
 /**
@@ -38,8 +36,6 @@
 
   /**
    * Returns a {@link Sha1HashCode} that represents the ABI of this rule's deps.
-   *
-   * @return {@link Optional#absent()} if not all deps that should have an ABI key have one.
    */
-  public Optional<Sha1HashCode> getAbiKeyForDeps() throws IOException;
+  public Sha1HashCode getAbiKeyForDeps() throws IOException;
 }
diff --git a/src/com/facebook/buck/rules/AbstractCachingBuildRule.java b/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
index 0920c77..381b62a 100644
--- a/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
+++ b/src/com/facebook/buck/rules/AbstractCachingBuildRule.java
@@ -340,10 +340,10 @@
       if (ruleKeyNoDeps.equals(cachedRuleKeyNoDeps.orNull())) {
         // The RuleKey for the definition of this build rule and its input files has not changed.
         // Therefore, if the ABI of its deps has not changed, there is nothing to rebuild.
-        Optional<Sha1HashCode> abiKeyForDeps = abiRule.getAbiKeyForDeps();
+        Sha1HashCode abiKeyForDeps = abiRule.getAbiKeyForDeps();
         Optional<Sha1HashCode> cachedAbiKeyForDeps = onDiskBuildInfo.getHash(
             AbiRule.ABI_KEY_FOR_DEPS_ON_DISK_METADATA);
-        if (abiKeyForDeps.isPresent() && abiKeyForDeps.equals(cachedAbiKeyForDeps)) {
+        if (abiKeyForDeps.equals(cachedAbiKeyForDeps.orNull())) {
           // Re-copy the ABI metadata.
           // TODO(mbolin): This seems really bad: there could be other metadata to copy, too?
           buildInfoRecorder.addMetadata(
diff --git a/test/com/facebook/buck/java/DefaultJavaLibraryRuleTest.java b/test/com/facebook/buck/java/DefaultJavaLibraryRuleTest.java
index 6c553b5..e1a3003 100644
--- a/test/com/facebook/buck/java/DefaultJavaLibraryRuleTest.java
+++ b/test/com/facebook/buck/java/DefaultJavaLibraryRuleTest.java
@@ -31,11 +31,11 @@
 import com.facebook.buck.event.BuckEventBusFactory;
 import com.facebook.buck.graph.MutableDirectedGraph;
 import com.facebook.buck.java.abi.AbiWriterProtocol;
-import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.model.BuildTargetFactory;
 import com.facebook.buck.model.BuildTargetPattern;
 import com.facebook.buck.rules.AbstractBuildRuleBuilderParams;
+import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.rules.BuildContext;
 import com.facebook.buck.rules.BuildDependencies;
 import com.facebook.buck.rules.BuildRule;
@@ -590,7 +590,7 @@
         commonWithExport.getAbiKeyForDeps());
     String expectedAbiKeyForDepsHash = Hashing.sha1().newHasher()
         .putUnencodedChars(tinyLibAbiKeyHash).hash().toString();
-    String observedAbiKeyForDepsHash = commonNoExport.getAbiKeyForDeps().get().getHash();
+    String observedAbiKeyForDepsHash = commonNoExport.getAbiKeyForDeps().getHash();
     assertEquals(expectedAbiKeyForDepsHash, observedAbiKeyForDepsHash);
 
     // Create a BuildRuleResolver populated with the three build rules we created thus far.
@@ -613,8 +613,8 @@
     // Verify getAbiKeyForDeps() for the two //:consumer_XXX rules.
     assertEquals(
         "The ABI of the deps of //:consumer_no_export should be the empty ABI.",
-        consumerNoExport.getAbiKeyForDeps(),
-        Optional.of(new Sha1HashCode(AbiWriterProtocol.EMPTY_ABI_KEY)));
+        new Sha1HashCode(AbiWriterProtocol.EMPTY_ABI_KEY),
+        consumerNoExport.getAbiKeyForDeps());
     assertThat(
         "Although //:consumer_no_export and //:consumer_with_export have the same deps, " +
         "the ABIs of their deps will differ because of the use of export_deps=True.",
@@ -626,7 +626,7 @@
         .hash()
         .toString();
     String observedAbiKeyNoDepsHashForConsumerWithExport = consumerWithExport.getAbiKeyForDeps()
-        .get().getHash();
+        .getHash();
     assertEquals(
         "By hardcoding the ABI keys for the deps, we made getAbiKeyForDeps() a predictable value.",
         expectedAbiKeyNoDepsHashForConsumerWithExport,
@@ -652,11 +652,11 @@
         JavacOptions.builder().build()
         ) {
       @Override
-      public Optional<Sha1HashCode> getAbiKey() {
+      public Sha1HashCode getAbiKey() {
         if (abiHash == null) {
           return super.getAbiKey();
         } else {
-          return Optional.of(new Sha1HashCode(abiHash));
+          return new Sha1HashCode(abiHash);
         }
       }
     };
diff --git a/test/com/facebook/buck/java/FakeJavaLibraryRule.java b/test/com/facebook/buck/java/FakeJavaLibraryRule.java
index 6a952f1..4a337a0 100644
--- a/test/com/facebook/buck/java/FakeJavaLibraryRule.java
+++ b/test/com/facebook/buck/java/FakeJavaLibraryRule.java
@@ -18,21 +18,18 @@
 
 import static com.facebook.buck.rules.BuildableProperties.Kind.LIBRARY;
 
-import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.model.BuildTarget;
 import com.facebook.buck.model.BuildTargetPattern;
+import com.facebook.buck.rules.AnnotationProcessingData;
 import com.facebook.buck.rules.BuildRule;
 import com.facebook.buck.rules.BuildRuleType;
 import com.facebook.buck.rules.BuildableProperties;
 import com.facebook.buck.rules.FakeBuildRule;
 import com.facebook.buck.rules.Sha1HashCode;
-import com.google.common.base.Optional;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.ImmutableSetMultimap;
 import com.google.common.collect.ImmutableSortedSet;
 
-import javax.annotation.Nullable;
-
 public class FakeJavaLibraryRule extends FakeBuildRule implements JavaLibraryRule {
 
   private final static BuildableProperties OUTPUT_TYPE = new BuildableProperties(LIBRARY);
@@ -76,8 +73,7 @@
   }
 
   @Override
-  @Nullable
-  public Optional<Sha1HashCode> getAbiKey() {
-    return Optional.absent();
+  public Sha1HashCode getAbiKey() {
+    throw new UnsupportedOperationException();
   }
 }
diff --git a/test/com/facebook/buck/java/PrebuiltJarRuleTest.java b/test/com/facebook/buck/java/PrebuiltJarRuleTest.java
index 2dbfbd4..ec71cf1 100644
--- a/test/com/facebook/buck/java/PrebuiltJarRuleTest.java
+++ b/test/com/facebook/buck/java/PrebuiltJarRuleTest.java
@@ -54,7 +54,7 @@
   public void testAbiKeyIsSameAsRuleKey() throws IOException {
     assertEquals(
         junitJarRule.getRuleKey().toString(),
-        junitJarRule.getAbiKey().get().getHash());
+        junitJarRule.getAbiKey().getHash());
   }
 
   @Test
diff --git a/test/com/facebook/buck/rules/AbstractCachingBuildRuleTest.java b/test/com/facebook/buck/rules/AbstractCachingBuildRuleTest.java
index 218ca4c..bf64210 100644
--- a/test/com/facebook/buck/rules/AbstractCachingBuildRuleTest.java
+++ b/test/com/facebook/buck/rules/AbstractCachingBuildRuleTest.java
@@ -511,8 +511,8 @@
     }
 
     @Override
-    public Optional<Sha1HashCode> getAbiKeyForDeps() {
-      return Optional.of(new Sha1HashCode(ABI_KEY_FOR_DEPS_HASH));
+    public Sha1HashCode getAbiKeyForDeps() {
+      return new Sha1HashCode(ABI_KEY_FOR_DEPS_HASH);
     }
   }