boolean (PsiModifierList modifierList1, PsiModifierList modifierList2) { if (!(modifierList1.getParent() instanceof PsiLocalVariable)) { // local variables can only have a final modifier, and are considered equivalent with or without it. for (String modifier : PsiModifier.MODIFIERS) { if (modifierList1.hasModifierProperty(modifier)) { if (!modifierList2.hasModifierProperty(modifier)) { return false; } } else if (modifierList2.hasModifierProperty(modifier)) { return false; } } } return AnnotationUtil.equal(modifierList1.getAnnotations(), modifierList2.getAnnotations()); }