void (@NotNull Project project, @NotNull PsiParameter parameter) { if (parameter.isUnnamed() || PsiUtil.isIgnoredName(parameter.getName())) return; PsiElement declarationScope = parameter.getDeclarationScope(); QuickFixFactory quickFixFactory = QuickFixFactory.getInstance(); if (declarationScope instanceof PsiMethod method) { if (PsiUtilCore.hasErrorElementChild(method)) return; if ((method.isConstructor() || method.hasModifierProperty(PsiModifier.PRIVATE) || method.hasModifierProperty(PsiModifier.STATIC) || !method.hasModifierProperty(PsiModifier.ABSTRACT) && (!isOverriddenOrOverrides(method) || myUnusedSymbolInspection.checkParameterExcludingHierarchy())) && !method.hasModifierProperty(PsiModifier.NATIVE) && !JavaHighlightUtil.isSerializationRelatedMethod(method, method.getContainingClass()) && !PsiClassImplUtil.isMainOrPremainMethod(method)) { if (UnusedSymbolUtil.isInjected(project, method)) return; checkUnusedParameter(parameter, method); if (message != null) { quickFixes.add(quickFixFactory.createRenameToIgnoredFix(parameter, true)); quickFixes.add(PriorityIntentionActionWrapper.highPriority( quickFixFactory.createSafeDeleteUnusedParameterInHierarchyFix(parameter, myUnusedSymbolInspection.checkParameterExcludingHierarchy() && isOverriddenOrOverrides(method)))); } } } else if (declarationScope instanceof PsiForeachStatement) { checkUnusedParameter(parameter, null); if (message != null) { quickFixes.add(quickFixFactory.createRenameToIgnoredFix(parameter, false)); } } else if (parameter instanceof PsiPatternVariable variable) { checkUnusedParameter(parameter, null); if (message != null) { PsiPattern pattern = variable.getPattern(); IntentionAction action = null; if (HighlightingFeature.UNNAMED_PATTERNS_AND_VARIABLES.isAvailable(parameter)) { if (pattern instanceof PsiTypeTestPattern ttPattern && pattern.getParent() instanceof PsiDeconstructionList) { PsiRecordComponent component = JavaPsiPatternUtil.getRecordComponentForPattern(pattern); PsiTypeElement checkType = ttPattern.getCheckType(); if (component != null && checkType != null && checkType.getType().isAssignableFrom(component.getType())) { action = new ReplaceWithUnnamedPatternFix(pattern).asIntention(); } } } if (action == null && declarationScope.getParent() instanceof PsiSwitchBlock) { action = variable.getParent() instanceof PsiDeconstructionPattern ? quickFixFactory.createDeleteFix(parameter) : quickFixFactory.createRenameToIgnoredFix(parameter, false); } else if (!(pattern instanceof PsiTypeTestPattern && pattern.getParent() instanceof PsiDeconstructionList)) { action = quickFixFactory.createDeleteFix(parameter); } if (action != null) { quickFixOptions.add(action); } } } else if ((myUnusedSymbolInspection.checkParameterExcludingHierarchy() || HighlightingFeature.UNNAMED_PATTERNS_AND_VARIABLES.isAvailable(declarationScope)) && declarationScope instanceof PsiLambdaExpression) { checkUnusedParameter(parameter, null); if (message != null) { quickFixes.add(quickFixFactory.createRenameToIgnoredFix(parameter, true)); quickFixes.add(PriorityIntentionActionWrapper.lowPriority(quickFixFactory.createSafeDeleteUnusedParameterInHierarchyFix(parameter, true))); } } }