void (@NotNull PsiInstanceOfExpression expression, @NotNull Consumer<? super HighlightInfo.Builder> errorSink) { PsiExpression operand = expression.getOperand(); PsiTypeElement typeElement = InstanceOfUtils.findCheckTypeElement(expression); if (typeElement == null) return; PsiType checkType = typeElement.getType(); PsiType operandType = operand.getType(); if (operandType == null) return; if (TypeConversionUtil.isPrimitiveAndNotNull(operandType) || TypeConversionUtil.isPrimitiveAndNotNull(checkType) || !TypeConversionUtil.areTypesConvertible(operandType, checkType)) { String message = JavaErrorBundle.message("inconvertible.type.cast", JavaHighlightUtil.formatType(operandType), JavaHighlightUtil .formatType(checkType)); HighlightInfo.Builder info = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(message); if (TypeConversionUtil.isPrimitiveAndNotNull(checkType)) { IntentionAction action = getFixFactory().createReplacePrimitiveWithBoxedTypeAction(operandType, typeElement); if (action != null) { info.registerFix(action, null, null, null, null); } } errorSink.accept(info); return; } PsiPrimaryPattern pattern = expression.getPattern(); if (pattern instanceof PsiDeconstructionPattern deconstruction) { PatternHighlightingModel.createDeconstructionErrors(deconstruction, errorSink); } }