aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/skyframe/serialization/autocodec
Commit message (Collapse)AuthorAge
* @AutoCodec SelectorValue. Rather than making mapMarshaller handle wildcards ↵Gravatar janakr2018-03-23
| | | | | | better, get rid of it, and immutableSetMarshaller for good measure. PiperOrigin-RevId: 190294922
* Allow AutoValue builder method to have the same name as getter method when ↵Gravatar janakr2018-03-23
| | | | | | using Strategy.AUTO_VALUE_BUILDER, and filter out #toBuilder()-type methods when collecting getters of class. PiperOrigin-RevId: 190292033
* Clean up unnecessary "additional data" from memoizing deserialization. Since ↵Gravatar janakr2018-03-21
| | | | | | memoization is now a simple on-off switch, change semantics to have at most one memoizing frame: starting memoization is now an idempotent operation. PiperOrigin-RevId: 189993914
* @Autocodec a few leftover classes. Also, add @AutoCodec builder support for ↵Gravatar cpeyser2018-03-20
| | | | | | boolean getters in "isFoo" form. PiperOrigin-RevId: 189753768
* Add unit tests for ↵Gravatar janakr2018-03-16
| | | | | | https://github.com/bazelbuild/bazel/commit/f304d2be2e8c26bd85434f1d6ca036f380162fb9 (oops). Also don't use concrete build() methods: there must be an abstract one, and crash explicitly if we don't have a Builder class, rather than with an NPE down the line. And remove non-functional partial handling of iterables. PiperOrigin-RevId: 189422625
* Add @AutoCodec strategy for @AutoValue.Builder.Gravatar janakr2018-03-16
| | | | | | Still missing a lot of features (most notably the ability to construct an iterable element by element), but this is ok for now. PiperOrigin-RevId: 189410898
* Deletes list marshaller and makes map entry marshaller into a runtime codec.Gravatar shahan2018-03-16
| | | | PiperOrigin-RevId: 189390024
* Makes leaf level AutoCodec marshallers into runtime codecs.Gravatar shahan2018-03-15
| | | | | | Next change will convert containers. PiperOrigin-RevId: 189261293
* Splits the iterableMarshaller into runtime codecs.Gravatar shahan2018-03-14
| | | | | | Makes NestedSetCodec into a runtime codec instead of a Marshaller. PiperOrigin-RevId: 189110883
* Integrate memoization into standard serialization. This involves a number of ↵Gravatar janakr2018-03-13
| | | | | | | | | | | | | | | | large changes: 1. SerializationContext and DeserializationContext become the owners of the Memoizer if requested. They produce new versions of themselves on demand that are memoization-aware. Because of intricacies of Skylark that I do not fully understand, we inject a Mutability object when starting memoization, and so to be conservative, that injection starts up a new memoization frame, nested if we were already memoizing, just like before. It would be nice to decouple this injection from memoization in the future. 2. MemoizingCodec is deleted, but really ObjectCodec becomes MemoizingCodec, so it lives on. BaseCodec is deleted since it now has only one implementation. 3. The simplified model of registering MemoizingCodecs is adopted for ObjectCodecs: all codecs are registered based on their #getEncodedClass and #additionalEncodedSubclasses. This also allows us to register codecs that are defined using tricky parameter types, since we're no longer trying to reflectively examine them. This required a clean-up of such codecs, and the addition of ArrayListCodec to stop NullableListCodec from making lists unmodifiable when they shouldn't be. 4. @AutoCodec is extended to allow users to specify that memoization should start with this codec. To ensure bit-equivalence, SkyKeySerializer disables memoization. PiperOrigin-RevId: 188918251
* Open-source ImmutableMapCodec and make it able to handle arbitrary ↵Gravatar janakr2018-03-10
| | | | | | | | | | keys/values without injecting the codecs. Also allow it to handle ImmutableSortedMap, since we were always silently degrading to ImmutableMap for objects that weren't declared as ImmutableSortedMap, and there's no good way to handle non-natural comparators. This will lead to runtime failures if a class actually needs an ImmutableSortedMap with a different comparator than the natural one. This changes the semantics of ImmutableMap serialization. Previously, we went off the declared type. In the case of a declared ImmutableSortedMap, we ignored the comparator, potentially leading to incorrect serialization (new test added in AutoCodecProcessorTest that would have caught that). Moreover, declared ImmutableMaps were deserialized as ImmutableMaps even if they were actually ImmutableSortedMaps. Now, we preserve the ordering unconditionally, and preserve the type if possible. I think this is a better state to be in. This is needed to kill off MemoizingCodec, since MemoizingCodec has an ImmutableMapMemoizingCodec, which I want to get rid of in favor of this. PiperOrigin-RevId: 188619637
* Add wildcard support to AutoCodec.Gravatar mjhalupka2018-03-06
| | | | PiperOrigin-RevId: 188034513
* @AutoCodec for TypeGravatar shahan2018-03-05
| | | | | | Needed for Attribute serialization. PiperOrigin-RevId: 187907727
* Get rid of almost all Skylark codecs. We need to introduce a wrapper to turn ↵Gravatar janakr2018-03-03
| | | | | | | | ObjectCodec into a MEMOIZE_AFTER MemoizingCodec. I think that this is safe, because all the codecs that are being wrapped this way weren't memoizing anything internally that I could see. In order to @AutoCodec the WithValue type, which is generic and can have null elements in lists, add functionality to @AutoCodec to deal with generic type static instantiators, matching generic type arguments (although I'm not sure why that wasn't already working), and null elements in lists. PiperOrigin-RevId: 187740461
* Create a runtime codec for HashCode.Gravatar mjhalupka2018-02-28
| | | | | | Remove the HashCode marshaller. PiperOrigin-RevId: 187350917
* Deletes AutoCodec.Strategy.SINGLETON now that we have @AutoCodec field tags.Gravatar shahan2018-02-28
| | | | | | This also gets rid of some static initialization cycles which we should try very hard to avoid in the future. PiperOrigin-RevId: 187334087
* Add RegisteredSingleton to Bazel bootstrap process.Gravatar janakr2018-02-27
| | | | PiperOrigin-RevId: 187199625
* Tag ParameterFileWriteAction with @AutoCodec.Gravatar mjhalupka2018-02-27
| | | | | | | | This requires codecs for CustomCommandLine and a Marshaller for Charset. Added AutoCodec functionality to generic classes like Iterable<T>. PiperOrigin-RevId: 187182889
* Allow @AutoCodec to tag static final fields, and generate a "pointer" class ↵Gravatar janakr2018-02-26
| | | | | | that has a single static INSTANCE field pointing back to the target field, so that serialization can grab it. PiperOrigin-RevId: 187065629
* Retain @AutoCodec at runtime.Gravatar janakr2018-02-26
| | | | PiperOrigin-RevId: 187059719
* Add support for parameterized types to AutoCodec.Gravatar cpeyser2018-02-26
| | | | | | | | | | AutoCodec still cannnot handle types with generic elements, e.g. class Foo<T> { private T member; } PiperOrigin-RevId: 187052487
* Add support to @AutoCodec for long and byte fields, and centralize primitive ↵Gravatar janakr2018-02-24
| | | | | | logic so that we can transparently handle arrays. We no longer care about the type of an object in AutoCodecProcessor: Marshallers is in charge of getting the correct code generator for array types anyway, so it can handle bare primitives as well. PiperOrigin-RevId: 186919695
* AutoCodec verifies that constructor parameter and field types are related.Gravatar shahan2018-02-24
| | | | | | | This isn't 100% safe, which requires 1:1 type correspondence, but can catch some errors at compile time. PiperOrigin-RevId: 186898025
* Deletes POLYMORPHIC strategy. ObjectCodec now uses runtime type information ↵Gravatar shahan2018-02-20
| | | | | | to select a codec. PiperOrigin-RevId: 186378153
* Adds ObjectCodecRegistry to {Des|S}erializationContext.Gravatar shahan2018-02-20
| | | | | | | | | | | | * AutoCodec now delegates to the registry. * Adds getSuperclass logic for resolving a codec. * Small cleanups for classes that break the registry. TODO after this change: * Explicit CODEC definitions are no longer needed and existing ones should be cleaned up. * POLYMORPHIC is no longer be needed and should be cleaned up. PiperOrigin-RevId: 186351845
* Some autocodec changes required to serialize SpawnAction: double field and ↵Gravatar cpeyser2018-02-20
| | | | | | CharSequence fields. PiperOrigin-RevId: 186323424
* Add a CODEC for CppCompileAction.Gravatar cpeyser2018-02-14
| | | | PiperOrigin-RevId: 185733313
* Add ability to use getter in AutoCodecProcessor when field for instantiator ↵Gravatar janakr2018-02-13
| | | | | | | | parameter isn't present. Allows us to handle cases where the class type encodes the parameter value. This also gives a compile-time check that field is present before blindly using it in codec. Lets us get rid of a non-AutoCodec class. PiperOrigin-RevId: 185573686
* Replaces InjectingObjectCodec with dependencies threaded through ↵Gravatar shahan2018-02-13
| | | | | | (Des|S)erializationContext. PiperOrigin-RevId: 185547740
* Add context argument to ObjectCodec.{serialize,deserialize}Gravatar michajlo2018-02-11
| | | | | | | | | | Context implementations are currently empty, just doing the plumbing in this change. Once this is in we can start passing along the ObjectCodecRegistry, which will allow runtime codec resolution for classes not known at compile time. We'll also inevitably add some memoization helpers, allowing us to optimize the serialization process further. PiperOrigin-RevId: 185305674
* Add support to Polymorphic strategy for grandchild classes that have no ↵Gravatar janakr2018-02-09
| | | | | | codec, but whose parent classes have codecs. This is ok because the polymorphic strategy doesn't need an instance of the grandchild class: the parent class is fine, so long as it has a codec. PiperOrigin-RevId: 185200943
* Add support for javabeans-style getters ("getFoo()", "isFoo()") to AutoCodec'sGravatar cpeyser2018-02-08
| | | | | | AutoValue support. This is required to serialize ActionOwner. PiperOrigin-RevId: 185037291
* Add an AutoCodec marshaller for UUID. This is required to serializeGravatar cpeyser2018-02-08
| | | | | | CppCompileAction. PiperOrigin-RevId: 185020942
* @AutoCodec adds Singleton strategy.Gravatar shahan2018-02-07
| | | | PiperOrigin-RevId: 184889583
* Add NestedSetCodec to AutoCodec's deploy jar.Gravatar cpeyser2018-02-06
| | | | PiperOrigin-RevId: 184784669
* @AutoCodec support for superclasses having generic parameters.Gravatar shahan2018-02-06
| | | | PiperOrigin-RevId: 184720361
* Add Supplier support to AutoCodec.Gravatar cpeyser2018-02-06
| | | | PiperOrigin-RevId: 184710375
* Makes @AutoCodec only use Instantiator parameter type information and ignoreGravatar shahan2018-02-06
| | | | | | field type information. PiperOrigin-RevId: 184695891
* Add a marshaller in AutoCodec for Iterable. This marshaller performs a ↵Gravatar cpeyser2018-02-06
| | | | | | runtime check on the type of the iterable, performing custom serialization for a NestedSet. PiperOrigin-RevId: 184686288
* Add NestedSet support in AutoCodec for type parameters which have an ↵Gravatar cpeyser2018-02-05
| | | | | | InjectingObjectCodec. PiperOrigin-RevId: 184566571
* AutoCodec can support NestedSet<T>, where T is a declared declared type thatGravatar cpeyser2018-02-02
| | | | | | | | has a CODEC member. AutoCodec cannot yet support other type parameters for NestedSet, like NestedSet<List<Foo>>. This will have to wait for AutoCodec Runtime. PiperOrigin-RevId: 184294808
* @AutoCodec @AutoValue supportGravatar shahan2018-02-01
| | | | PiperOrigin-RevId: 184211212
* Allows @AutoCodec to use factory methods.Gravatar shahan2018-01-29
| | | | | | Generalizes @AutoCodec.Constructor to @AutoCodec.Instantiator. PiperOrigin-RevId: 183702768
* Makes @AutoCodec preserve map order when it sees Map or ImmutableMap raw ↵Gravatar shahan2018-01-24
| | | | | | types instead of sorting. PiperOrigin-RevId: 183083445
* Add serialization codec for SkylarkImports. This is needed to serialize ↵Gravatar janakr2018-01-18
| | | | | | | | SkylarkAspectLoadingKey. Also add a @VisibleForSerialization annotation to @AutoCodec, since we're going to need to increase serialization visibility a lot here, and clean up some unnecessary modifiers. PiperOrigin-RevId: 182389162
* [Autocodec] Add a ImmutableSetCodec. ImmutableCollections have a deterministicGravatar Googler2018-01-17
| | | | | | iteration order so we should be okay. PiperOrigin-RevId: 182235068
* Support array fields in AutoCodec. To do this, introduceGravatar cpeyser2018-01-16
| | | | | | | SerializationCodeGenerator, which is a generalization of Marshaller that supports primitive and array values. PiperOrigin-RevId: 182053617
* AutoCodec proto marshaller bug fix and support for mutable Map.Gravatar shahan2018-01-10
| | | | PiperOrigin-RevId: 181533491
* AutoCodec's constructor strategy recognizes fields in a (transitive)Gravatar cpeyser2018-01-10
| | | | | | superclass of the class in question. PiperOrigin-RevId: 181524469
* Adds a CODEC for CppConfiguration.Gravatar shahan2018-01-10
| | | | | | | * Creates an enum for cpu transformer, which is easier to serialize than an opaque function. This also means moving FakeCPU to avoid introducing a circular dependency. * Adds a CODEC to Path using InjectingObjectCodec. PiperOrigin-RevId: 181445911