MatchException at runtime
+due to null values in deconstruction patterns.
+
+
+ The inspection analyzes record components with @Nullable annotation to detect cases where
+ deconstruction patterns may not cover null values.
+
Example:
+
+sealed interface II {
+ record AI() implements II {}
+ record BI() implements II {}
+}
+
+record RI(@Nullable II value) {}
+
+private static II getII(RI ri) {
+ return switch (ri) {
+ case RI(II.BI bi) -> bi; // MatchException if ri.value is null
+ case RI(II.AI ai) -> ai;
+ };
+}
+
+
+
+ Use the provided quick-fix to add a default branch to handle unmatched cases safely.
+
New in 2026.1 + +