Пример #1
0
 @NotNull
 public static Set<String> modifiersListToModifiersSet(@Nullable PsiModifierList modifierList) {
   Set<String> modifiersSet = new HashSet<String>();
   if (modifierList != null) {
     if (modifierList.hasExplicitModifier(PsiModifier.ABSTRACT))
       modifiersSet.add(Modifier.ABSTRACT);
     if (modifierList.hasModifierProperty(PsiModifier.FINAL)) modifiersSet.add(Modifier.FINAL);
     if (modifierList.hasModifierProperty(PsiModifier.STATIC)) modifiersSet.add(Modifier.STATIC);
     if (modifierList.hasExplicitModifier(PsiModifier.PUBLIC)) modifiersSet.add(Modifier.PUBLIC);
     if (modifierList.hasExplicitModifier(PsiModifier.PROTECTED))
       modifiersSet.add(Modifier.PROTECTED);
     if (modifierList.hasExplicitModifier(PsiModifier.PACKAGE_LOCAL))
       modifiersSet.add(Modifier.INTERNAL);
     if (modifierList.hasExplicitModifier(PsiModifier.PRIVATE)) modifiersSet.add(Modifier.PRIVATE);
   }
   return modifiersSet;
 }
Пример #2
0
 private static boolean isNotOpenMethod(@NotNull PsiMethod method) {
   if (method.getParent() instanceof PsiClass) {
     PsiModifierList parentModifierList = ((PsiClass) method.getParent()).getModifierList();
     if ((parentModifierList != null && parentModifierList.hasExplicitModifier(Modifier.FINAL))
         || ((PsiClass) method.getParent()).isEnum()) {
       return true;
     }
   }
   return false;
 }