mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
EA-64618 one more null check
This commit is contained in:
+4
-2
@@ -839,12 +839,14 @@ public class GroovyTypeCheckVisitor extends BaseInspectionVisitor {
|
||||
public void visitCastExpression(GrTypeCastExpression expression) {
|
||||
super.visitCastExpression(expression);
|
||||
|
||||
if (expression.getCastTypeElement() == null) return;
|
||||
final PsiType expectedType = expression.getCastTypeElement().getType();
|
||||
final GrExpression operand = expression.getOperand();
|
||||
if (operand == null) return;
|
||||
final PsiType actualType = operand.getType();
|
||||
if (actualType == null) return;
|
||||
|
||||
if (expression.getCastTypeElement() == null) return;
|
||||
final PsiType expectedType = expression.getCastTypeElement().getType();
|
||||
|
||||
final ConversionResult result = TypesUtil.canCast(expectedType, actualType, expression);
|
||||
if (result == ConversionResult.OK) return;
|
||||
final ProblemHighlightType highlightType = result == ConversionResult.ERROR
|
||||
|
||||
+2
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -26,6 +27,7 @@ import com.intellij.psi.PsiElement;
|
||||
public interface GrTypeCastExpression extends GrExpression {
|
||||
GrTypeElement getCastTypeElement();
|
||||
|
||||
@Nullable
|
||||
GrExpression getOperand();
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
@@ -58,6 +59,7 @@ public class GrTypeCastExpressionImpl extends GrExpressionImpl implements GrType
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public GrExpression getOperand() {
|
||||
return findExpressionChild(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user