diff options
author | janakr <janakr@google.com> | 2018-06-05 10:26:02 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-06-05 10:28:09 -0700 |
commit | 459b244216900506a052d56ad890fa1194882608 (patch) | |
tree | ba1f12cdf2433d7642f82f8f01c4a46033cf559f /src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java | |
parent | fc23edc368244849c59636d1e2ae6c375bebf262 (diff) |
Add functionality to SerializationContext and @AutoCodec to check that a class is allowed to be serialized in the current context. A codec can now add an explicitly allowed class that can be serialized underneath it (via SerializationContext#addExplicitlyAllowedClass), and that class's codec can check that it is explicitly allowed (via SerializationContext#checkClassExplicitlyAllowed). It is a runtime crash if a codec checks that it was explicitly allowed and finds that it wasn't. Thus, if PackageCodec is invoked without it having been explicitly allowed, we will crash, preventing Package from sneaking into a value it shouldn't be in.
This is only enabled if the codec is memoizing.
PiperOrigin-RevId: 199317936
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java index ba1962335b..babdce6d16 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageValue.java @@ -30,7 +30,7 @@ import java.util.ArrayList; import java.util.List; /** A Skyframe value representing a package. */ -@AutoCodec +@AutoCodec(explicitlyAllowClass = Package.class) @Immutable @ThreadSafe public class PackageValue implements NotComparableSkyValue { |