void (@NotNull GrNewExpression newExpression) { GrTypeArgumentList constructorTypeArguments = newExpression.getConstructorTypeArguments(); if (constructorTypeArguments != null) { myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("groovy.does.not.support.constructor.type.arguments")).range(constructorTypeArguments).create(); } final GrTypeElement typeElement = newExpression.getTypeElement(); if (typeElement instanceof GrBuiltInTypeElement) { if (newExpression.getArrayCount() == 0) { myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("create.instance.of.built-in.type")).range(typeElement).create(); } } if (newExpression.getArrayCount() > 0) return; GrCodeReferenceElement refElement = newExpression.getReferenceElement(); if (refElement == null) return; final PsiElement element = refElement.resolve(); if (element instanceof PsiClass clazz) { if (clazz.hasModifierProperty(PsiModifier.ABSTRACT)) { if (newExpression.getAnonymousClassDefinition() == null) { String message = clazz.isInterface() ? GroovyBundle.message("cannot.instantiate.interface", clazz.getName()) : GroovyBundle.message("cannot.instantiate.abstract.class", clazz.getName()); myHolder.newAnnotation(HighlightSeverity.ERROR, message).range(refElement).create(); } } } }