Add a way for options classes to mark that they are skyframe-friendly
You can now use the annotation @UsesOnlyCoreTypes on a subclass of OptionsBase, to indicate that all of its options' types are restricted to a whitelist of immutable and serializable types. Subclasses of the annotated class must also follow the same restriction.
RELNOTES: None
PiperOrigin-RevId: 154328920
diff --git a/src/main/java/com/google/devtools/common/options/OptionsBase.java b/src/main/java/com/google/devtools/common/options/OptionsBase.java
index 48658f7..315efe8 100644
--- a/src/main/java/com/google/devtools/common/options/OptionsBase.java
+++ b/src/main/java/com/google/devtools/common/options/OptionsBase.java
@@ -66,7 +66,8 @@
*/
public final <O extends OptionsBase> Map<String, Object> asMap() {
// Generic O is needed to tell the type system that the toMap() call is safe.
- // The casts are safe because this <= O <= OptionsBase.
+ // The casts are safe because "this" is an instance of "getClass()"
+ // which subclasses OptionsBase.
@SuppressWarnings("unchecked")
O castThis = (O) this;
@SuppressWarnings("unchecked")