From 264aeca72a863db2a7258ddc9ea330b3d9bd1ac3 Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Wed, 28 Oct 2020 15:47:40 +0100 Subject: [PATCH] RegExp: make getPattern() @NotNull GitOrigin-RevId: 82b8089e824064f72212dd1086f66ef7fff34a55 --- .../src/org/intellij/lang/regexp/psi/RegExpGroup.java | 4 ++-- .../org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java index 0b3644fbb728..6de805d100c8 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/RegExpGroup.java @@ -16,14 +16,14 @@ package org.intellij.lang.regexp.psi; import com.intellij.psi.PsiNamedElement; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public interface RegExpGroup extends RegExpAtom, PsiNamedElement { boolean isCapturing(); - @Nullable - RegExpPattern getPattern(); + @NotNull RegExpPattern getPattern(); /** @deprecated use #getType() */ @Deprecated diff --git a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java index 1b67d28bafa0..72b513faacc6 100644 --- a/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java +++ b/RegExpSupport/src/org/intellij/lang/regexp/psi/impl/RegExpGroupImpl.java @@ -38,9 +38,10 @@ public class RegExpGroupImpl extends RegExpElementImpl implements RegExpGroup { } @Override - public RegExpPattern getPattern() { + public @NotNull RegExpPattern getPattern() { final ASTNode node = getNode().findChildByType(RegExpElementTypes.PATTERN); - return node != null ? (RegExpPattern)node.getPsi() : null; + assert node != null; + return (RegExpPattern)node.getPsi(); } @Override