Search in sources :

Example 1 with RemoveModifierFix

use of com.siyeh.ig.fixes.RemoveModifierFix in project intellij-community by JetBrains.

the class PublicConstructorInNonPublicClassInspection method buildFixes.

@Override
@NotNull
public InspectionGadgetsFix[] buildFixes(Object... infos) {
    final List<InspectionGadgetsFix> fixes = new ArrayList();
    final PsiMethod constructor = (PsiMethod) infos[0];
    final PsiClass aClass = constructor.getContainingClass();
    if (aClass != null && aClass.hasModifierProperty(PsiModifier.PRIVATE)) {
        fixes.add(new SetConstructorModifierFix(PsiModifier.PRIVATE));
    }
    fixes.add(new RemoveModifierFix(PsiModifier.PUBLIC));
    return fixes.toArray(new InspectionGadgetsFix[fixes.size()]);
}
Also used : RemoveModifierFix(com.siyeh.ig.fixes.RemoveModifierFix) ArrayList(java.util.ArrayList) InspectionGadgetsFix(com.siyeh.ig.InspectionGadgetsFix) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

InspectionGadgetsFix (com.siyeh.ig.InspectionGadgetsFix)1 RemoveModifierFix (com.siyeh.ig.fixes.RemoveModifierFix)1 ArrayList (java.util.ArrayList)1 NotNull (org.jetbrains.annotations.NotNull)1