boolean (@NotNull PsiDeconstructionPattern pattern) { PsiType type = pattern.getTypeElement().getType(); PsiPattern[] patternComponents = pattern.getDeconstructionList().getDeconstructionComponents(); PsiClass selectorClass = PsiUtil.resolveClassInClassTypeOnly(type); if (selectorClass == null) return false; PsiRecordComponent[] recordComponents = selectorClass.getRecordComponents(); if (patternComponents.length != recordComponents.length) return false; for (int i = 0; i < patternComponents.length; i++) { PsiPattern patternComponent = patternComponents[i]; PsiType componentType = recordComponents[i].getType(); if (!isUnconditionalForType(patternComponent, componentType)) { return false; } } return true; }