@Override
      public void visitElement(@NotNull PsiElement element) {
        if (element instanceof GrReferenceExpression && !((GrReferenceElement<?>)element).isQualified()) {
          GroovyResolveResult[] results = ((GrReferenceExpression)element).multiResolve(false);
          if (results.length == 0) {
            results = ((GrReferenceExpression)element).multiResolve(true);
          }
          for (GroovyResolveResult result : results) {
            PsiElement resolved = result.getElement();
            if (resolved instanceof GrParameter && resolved.getContainingFile() == myFile) {
              usedParams.put((GrParameter)resolved, Boolean.TRUE);
            }
          }
        }

        if (deadCodeEnabled &&
            element instanceof GrNamedElement && element instanceof PsiModifierListOwner &&
            !UnusedSymbolUtil.isImplicitUsage(element.getProject(), (PsiModifierListOwner)element) &&
            !GroovySuppressableInspectionTool.isElementToolSuppressedIn(element, GroovyUnusedDeclarationInspection.SHORT_NAME)) {
          PsiElement nameId = ((GrNamedElement)element).getNameIdentifierGroovy();
          if (nameId.getNode().getElementType() == GroovyTokenTypes.mIDENT) {
            String name = ((GrNamedElement)element).getName();
            if (element instanceof GrTypeDefinition && !UnusedSymbolUtil.isClassUsed(myProject,
                                                                                     element.getContainingFile(), (GrTypeDefinition)element,
                                                                                     usageHelper
            )) {
              HighlightInfo.Builder builder = UnusedSymbolUtil
                .createUnusedSymbolInfoBuilder(nameId, GroovyBundle.message("text.class.0.is.unused", name), HighlightInfoType.UNUSED_SYMBOL, GroovyUnusedDeclarationInspection.SHORT_NAME);
              IntentionAction action = QuickFixFactory.getInstance().createSafeDeleteFix(element);
              builder.registerFix(action, null, HighlightDisplayKey.getDisplayNameByKey(unusedDefKey), null, unusedDefKey);
              ContainerUtil.addIfNotNull(unusedDeclarations, builder.create());
            }
            else if (element instanceof GrMethod method) {
              if (SpockUtils.isUnusedInSpock(method, usageHelper)) {
                usageHelper.shouldCheckContributors = false;
              }
              try {
                if (!UnusedSymbolUtil.isMethodUsed(method.getProject(), method.getContainingFile(), method, usageHelper)) {
                  String message;
                  if (method.isConstructor()) {
                    message = GroovyBundle.message("text.constructor.0.is.unused", name);
                  } else {
                    message = GroovyBundle.message("text.method.0.is.unused", name);
                  }
                  HighlightInfo.Builder builder = UnusedSymbolUtil.createUnusedSymbolInfoBuilder(nameId, message, HighlightInfoType.UNUSED_SYMBOL, GroovyUnusedDeclarationInspection.SHORT_NAME);
                  IntentionAction action = QuickFixFactory.getInstance().createSafeDeleteFix(method);
                  builder.registerFix(action, null, HighlightDisplayKey.getDisplayNameByKey(unusedDefKey), null, unusedDefKey);
                  ContainerUtil.addIfNotNull(unusedDeclarations, builder.create());
                }
              }
              finally {
                usageHelper.shouldCheckContributors = true;
              }
            }
            else if (element instanceof GrField && isFieldUnused((GrField)element, usageHelper)) {
              HighlightInfo.Builder builder =
                UnusedSymbolUtil.createUnusedSymbolInfoBuilder(nameId, GroovyBundle.message("text.property.0.is.unused", name), HighlightInfoType.UNUSED_SYMBOL, GroovyUnusedDeclarationInspection.SHORT_NAME);
              IntentionAction action = QuickFixFactory.getInstance().createSafeDeleteFix(element);
              builder.registerFix(action, null, HighlightDisplayKey.getDisplayNameByKey(unusedDefKey), null, unusedDefKey);
              ContainerUtil.addIfNotNull(unusedDeclarations, builder.create());
            }
            else if (element instanceof GrParameter) {
              if (!usedParams.containsKey(element)) {
                usedParams.put((GrParameter)element, Boolean.FALSE);
              }
            }
          }
        }

        super.visitElement(element);
      }
@Override
      public void visitElement(@NotNull PsiElement element)