PsiUnnamedPattern (PsiElementFactory factory) { PsiInstanceOfExpression expr = (PsiInstanceOfExpression)factory .createExpressionFromText("x instanceof R(_)", null); PsiDeconstructionPattern pattern = (PsiDeconstructionPattern)Objects.requireNonNull(expr.getPattern()); return ((PsiUnnamedPattern)pattern.getDeconstructionList().getDeconstructionComponents()[0]); }