Get rid of almost all Skylark codecs. We need to introduce a wrapper to turn 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
diff --git a/src/main/java/com/google/devtools/build/lib/syntax/AbstractComprehension.java b/src/main/java/com/google/devtools/build/lib/syntax/AbstractComprehension.java
index 9f53513..ae8af0a 100644
--- a/src/main/java/com/google/devtools/build/lib/syntax/AbstractComprehension.java
+++ b/src/main/java/com/google/devtools/build/lib/syntax/AbstractComprehension.java
@@ -16,6 +16,7 @@
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.events.Location;
+import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
import java.io.IOException;
import java.io.Serializable;
import java.util.ArrayList;
@@ -93,9 +94,8 @@
void prettyPrint(Appendable buffer) throws IOException;
}
- /**
- * A for clause in a comprehension, e.g. "for a in b" in the example above.
- */
+ /** A for clause in a comprehension, e.g. "for a in b" in the example above. */
+ @AutoCodec
public static final class ForClause implements Clause {
private final LValue lvalue;
private final Expression iterable;
@@ -158,9 +158,8 @@
}
}
- /**
- * A if clause in a comprehension, e.g. "if c" in the example above.
- */
+ /** A if clause in a comprehension, e.g. "if c" in the example above. */
+ @AutoCodec
public static final class IfClause implements Clause {
private final Expression condition;