IDEA-80324: do not ignore override preferences in the call place
authorAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 25 Jan 2012 13:15:22 +0000 (17:15 +0400)
committerAnna Kozlova <anna.kozlova@jetbrains.com>
Wed, 25 Jan 2012 15:49:06 +0000 (19:49 +0400)
java/java-impl/src/com/intellij/codeInsight/generation/OverrideImplementUtil.java

index b565b9a42c2482ccd468cb810d079c356913f09f..c0d2cb5b607550e222ae30789dd4e99ef64909d4 100644 (file)
@@ -222,11 +222,17 @@ public class OverrideImplementUtil {
   }
 
   public static boolean isInsertOverride(PsiMethod superMethod, PsiClass targetClass) {
+    if (!CodeStyleSettingsManager.getSettings(targetClass.getProject()).INSERT_OVERRIDE_ANNOTATION) {
+      return false;
+    }
+    return canInsertOverride(superMethod, targetClass);
+  }
+
+  public static boolean canInsertOverride(PsiMethod superMethod, PsiClass targetClass) {
     if (superMethod.isConstructor()) {
       return false;
     }
-    if (!CodeStyleSettingsManager.getSettings(targetClass.getProject()).INSERT_OVERRIDE_ANNOTATION
-        || !PsiUtil.isLanguageLevel5OrHigher(targetClass)) {
+    if (!PsiUtil.isLanguageLevel5OrHigher(targetClass)) {
       return false;
     }
     if (PsiUtil.isLanguageLevel6OrHigher(targetClass)) return true;
@@ -329,7 +335,7 @@ public class OverrideImplementUtil {
   }
 
   public static void annotateOnOverrideImplement(PsiMethod method, PsiClass targetClass, PsiMethod overridden, boolean insertOverride) {
-    if (insertOverride && isInsertOverride(overridden, targetClass)) {
+    if (insertOverride && canInsertOverride(overridden, targetClass)) {
       annotate(method, Override.class.getName());
     }
     final Module module = ModuleUtil.findModuleForPsiElement(targetClass);