diff options
author | Michajlo Matijkiw <michajlo@google.com> | 2015-10-16 19:00:45 +0000 |
---|---|---|
committer | Lukacs Berki <lberki@google.com> | 2015-10-19 08:20:04 +0000 |
commit | 111845955c1c136729a1c0a2226962309ca45957 (patch) | |
tree | aeb0dee75699c1e19b1270c6b8b511cda869bff9 /src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java | |
parent | e4461a4251131a78d26b5e822e4ba388950c9d48 (diff) |
Brief audit of singleton SkyValues
Minimize indirection wrt singletons, turns out we had one that was completely unused.
--
MOS_MIGRATED_REVID=105621494
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java index 09731a2f06..70bdf0d07d 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ContainingPackageLookupValue.java @@ -25,6 +25,9 @@ import com.google.devtools.build.skyframe.SkyValue; * a specific package. */ public abstract class ContainingPackageLookupValue implements SkyValue { + + public static final NoContainingPackage NONE = new NoContainingPackage(); + /** Returns whether there is a containing package. */ public abstract boolean hasContainingPackage(); @@ -39,16 +42,14 @@ public abstract class ContainingPackageLookupValue implements SkyValue { return new SkyKey(SkyFunctions.CONTAINING_PACKAGE_LOOKUP, id); } - static ContainingPackageLookupValue noContainingPackage() { - return NoContainingPackage.INSTANCE; - } - static ContainingPackageLookupValue withContainingPackage(PackageIdentifier pkgId, Path root) { return new ContainingPackage(pkgId, root); } - private static class NoContainingPackage extends ContainingPackageLookupValue { - private static final NoContainingPackage INSTANCE = new NoContainingPackage(); + /** Value indicating there is no containing package. */ + public static class NoContainingPackage extends ContainingPackageLookupValue { + + private NoContainingPackage() {} @Override public boolean hasContainingPackage() { @@ -66,7 +67,8 @@ public abstract class ContainingPackageLookupValue implements SkyValue { } } - private static class ContainingPackage extends ContainingPackageLookupValue { + /** A successful lookup value. */ + public static class ContainingPackage extends ContainingPackageLookupValue { private final PackageIdentifier containingPackage; private final Path containingPackageRoot; |