use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.
the class NullArgumentToVariableArgMethodInspection method buildFixes.
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final PsiExpression argument = (PsiExpression) infos[0];
final PsiType type1 = (PsiType) infos[1];
final PsiType type2 = (PsiType) infos[2];
return new InspectionGadgetsFix[] { new DelegatingFix(new AddTypeCastFix(type1, argument)), new DelegatingFix(new AddTypeCastFix(type2, argument)) };
}
use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.
the class CallToSuspiciousStringMethodInspection method buildFixes.
@Override
@NotNull
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final PsiMethodCallExpression methodCallExpression = (PsiMethodCallExpression) infos[0];
final List<InspectionGadgetsFix> result = new ArrayList<>();
final PsiReferenceExpression methodExpression = methodCallExpression.getMethodExpression();
final PsiModifierListOwner annotatableQualifier = NonNlsUtils.getAnnotatableQualifier(methodExpression);
if (annotatableQualifier != null) {
final InspectionGadgetsFix fix = new DelegatingFix(new AddAnnotationPsiFix(AnnotationUtil.NON_NLS, annotatableQualifier, PsiNameValuePair.EMPTY_ARRAY));
result.add(fix);
}
final PsiModifierListOwner annotatableArgument = NonNlsUtils.getAnnotatableArgument(methodCallExpression);
if (annotatableArgument != null) {
final InspectionGadgetsFix fix = new DelegatingFix(new AddAnnotationPsiFix(AnnotationUtil.NON_NLS, annotatableArgument, PsiNameValuePair.EMPTY_ARRAY));
result.add(fix);
}
return result.toArray(new InspectionGadgetsFix[result.size()]);
}
use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.
the class UnusedCatchParameterInspection method buildFixes.
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final boolean namedIgnoreButUsed = ((Boolean) infos[0]).booleanValue();
final PsiElement context = (PsiElement) infos[1];
final InspectionGadgetsFix fix = SuppressForTestsScopeFix.build(this, context);
if (namedIgnoreButUsed) {
if (fix == null) {
return InspectionGadgetsFix.EMPTY_ARRAY;
}
return new InspectionGadgetsFix[] { fix };
}
final RenameFix renameFix = new RenameFix("ignored", false, false);
if (fix == null) {
return new InspectionGadgetsFix[] { renameFix };
}
return new InspectionGadgetsFix[] { renameFix, fix };
}
use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.
the class MagicNumberInspection method buildFixes.
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final PsiElement context = (PsiElement) infos[0];
final InspectionGadgetsFix fix = SuppressForTestsScopeFix.build(this, context);
if (fix == null) {
return new InspectionGadgetsFix[] { new IntroduceConstantFix() };
}
return new InspectionGadgetsFix[] { new IntroduceConstantFix(), fix };
}
use of com.siyeh.ig.InspectionGadgetsFix in project intellij-community by JetBrains.
the class EmptyCatchBlockInspection method buildFixes.
@NotNull
@Override
protected InspectionGadgetsFix[] buildFixes(Object... infos) {
final PsiElement context = (PsiElement) infos[0];
final SuppressForTestsScopeFix fix = SuppressForTestsScopeFix.build(this, context);
if (fix == null) {
return new InspectionGadgetsFix[] { buildFix(infos) };
}
return new InspectionGadgetsFix[] { buildFix(infos), fix };
}
Aggregations