mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-highlighting] Migrate fallthrough-related errors
Part of IDEA-365344 Create a new Java error highlighter with minimal dependencies (PSI only) GitOrigin-RevId: 0a2b7e91a93e8207101368c0fcfb3cf58a793203
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1da6f5d864
commit
6d7ef89b5a
@@ -0,0 +1,22 @@
|
||||
// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.java.codeserver.core;
|
||||
|
||||
import com.intellij.psi.PsiExpression;
|
||||
import com.intellij.psi.PsiLiteralExpression;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Utilities related to Java expressions
|
||||
*/
|
||||
public final class JavaPsiExpressionUtil {
|
||||
/**
|
||||
* @param expression expression to check
|
||||
* @return true if the expression is a null literal (possibly parenthesized or cast)
|
||||
*/
|
||||
@Contract("null -> false")
|
||||
public static boolean isNullLiteral(@Nullable PsiExpression expression) {
|
||||
return PsiUtil.deparenthesizeExpression(expression) instanceof PsiLiteralExpression literal && literal.getValue() == null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user