aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
diff options
context:
space:
mode:
authorGravatar Michajlo Matijkiw <michajlo@google.com>2015-10-16 19:00:45 +0000
committerGravatar Lukacs Berki <lberki@google.com>2015-10-19 08:20:04 +0000
commit111845955c1c136729a1c0a2226962309ca45957 (patch)
treeaeb0dee75699c1e19b1270c6b8b511cda869bff9 /src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
parente4461a4251131a78d26b5e822e4ba388950c9d48 (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/PackageLookupValue.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java53
1 files changed, 10 insertions, 43 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
index 492fdfb254..7eb743f651 100644
--- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
+++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageLookupValue.java
@@ -36,6 +36,11 @@ import java.util.Objects;
*/
public abstract class PackageLookupValue implements SkyValue {
+ public static final NoBuildFilePackageLookupValue NO_BUILD_FILE_VALUE =
+ new NoBuildFilePackageLookupValue();
+ public static final DeletedPackageLookupValue DELETED_PACKAGE_VALUE =
+ new DeletedPackageLookupValue();
+
enum ErrorReason {
// There is no BUILD file.
NO_BUILD_FILE,
@@ -44,11 +49,7 @@ public abstract class PackageLookupValue implements SkyValue {
INVALID_PACKAGE_NAME,
// The package is considered deleted because of --deleted_packages.
- DELETED_PACKAGE,
-
- // The //external package could not be loaded, either because the WORKSPACE file could not be
- // parsed or the packages it references cannot be loaded.
- NO_EXTERNAL_PACKAGE
+ DELETED_PACKAGE
}
protected PackageLookupValue() {
@@ -67,22 +68,10 @@ public abstract class PackageLookupValue implements SkyValue {
return new WorkspacePackageLookupValue(root);
}
- public static PackageLookupValue noBuildFile() {
- return NoBuildFilePackageLookupValue.INSTANCE;
- }
-
- public static PackageLookupValue noExternalPackage() {
- return NoExternalPackageLookupValue.INSTANCE;
- }
-
public static PackageLookupValue invalidPackageName(String errorMsg) {
return new InvalidNamePackageLookupValue(errorMsg);
}
- public static PackageLookupValue deletedPackage() {
- return DeletedPackageLookupValue.INSTANCE;
- }
-
public boolean isExternalPackage() {
return false;
}
@@ -225,10 +214,8 @@ public abstract class PackageLookupValue implements SkyValue {
}
}
- private static class NoBuildFilePackageLookupValue extends UnsuccessfulPackageLookupValue {
-
- public static final NoBuildFilePackageLookupValue INSTANCE =
- new NoBuildFilePackageLookupValue();
+ /** Marker value for no build file found. */
+ public static class NoBuildFilePackageLookupValue extends UnsuccessfulPackageLookupValue {
private NoBuildFilePackageLookupValue() {
}
@@ -244,25 +231,6 @@ public abstract class PackageLookupValue implements SkyValue {
}
}
- private static class NoExternalPackageLookupValue extends UnsuccessfulPackageLookupValue {
-
- public static final NoExternalPackageLookupValue INSTANCE =
- new NoExternalPackageLookupValue();
-
- private NoExternalPackageLookupValue() {
- }
-
- @Override
- ErrorReason getErrorReason() {
- return ErrorReason.NO_EXTERNAL_PACKAGE;
- }
-
- @Override
- String getErrorMsg() {
- return "Error loading the //external package";
- }
- }
-
private static class InvalidNamePackageLookupValue extends UnsuccessfulPackageLookupValue {
private final String errorMsg;
@@ -296,9 +264,8 @@ public abstract class PackageLookupValue implements SkyValue {
}
}
- private static class DeletedPackageLookupValue extends UnsuccessfulPackageLookupValue {
-
- public static final DeletedPackageLookupValue INSTANCE = new DeletedPackageLookupValue();
+ /** Marker value for a deleted package. */
+ public static class DeletedPackageLookupValue extends UnsuccessfulPackageLookupValue {
private DeletedPackageLookupValue() {
}