You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by do...@apache.org on 2026/03/30 19:20:41 UTC
(spark-kubernetes-operator) branch main updated: [SPARK-56291] Make `BaseStateSummary` a `sealed` interface
This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/spark-kubernetes-operator.git
The following commit(s) were added to refs/heads/main by this push:
new b3453b2 [SPARK-56291] Make `BaseStateSummary` a `sealed` interface
b3453b2 is described below
commit b3453b2d83933cf78e31f850d116af41e2d02d9c
Author: Dongjoon Hyun <do...@apache.org>
AuthorDate: Mon Mar 30 12:20:32 2026 -0700
[SPARK-56291] Make `BaseStateSummary` a `sealed` interface
### What changes were proposed in this pull request?
This PR makes `BaseStateSummary` a `sealed` interface with `permits ApplicationStateSummary, ClusterStateSummary`.
### Why are the changes needed?
Using a `sealed` interface explicitly restricts the permitted implementations, improving type safety and enabling exhaustive pattern matching in `switch` expressions with Java 21.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Pass the CIs with the existing tests.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Code (Claude Opus 4.6)
Closes #605 from dongjoon-hyun/SPARK-56291.
Authored-by: Dongjoon Hyun <do...@apache.org>
Signed-off-by: Dongjoon Hyun <do...@apache.org>
---
.../java/org/apache/spark/k8s/operator/status/BaseStateSummary.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/spark-operator-api/src/main/java/org/apache/spark/k8s/operator/status/BaseStateSummary.java b/spark-operator-api/src/main/java/org/apache/spark/k8s/operator/status/BaseStateSummary.java
index 61cf0ce..deb8b0d 100644
--- a/spark-operator-api/src/main/java/org/apache/spark/k8s/operator/status/BaseStateSummary.java
+++ b/spark-operator-api/src/main/java/org/apache/spark/k8s/operator/status/BaseStateSummary.java
@@ -24,7 +24,8 @@ package org.apache.spark.k8s.operator.status;
*
* @since 0.1.0
*/
-public interface BaseStateSummary {
+public sealed interface BaseStateSummary
+ permits ApplicationStateSummary, ClusterStateSummary {
/**
* Checks if the CustomResource has failed.
*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org