summaryrefslogtreecommitdiff
path: root/java/java-impl/src/com/intellij/codeInsight/daemon
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2013-06-21 16:58:30 -0700
committerTor Norbye <tnorbye@google.com>2013-06-21 16:58:30 -0700
commitc6218e46d5d2017e987ecdbd99b318a95c42abc0 (patch)
tree85106b3c757a794fb274159cebe07c8d979740a5 /java/java-impl/src/com/intellij/codeInsight/daemon
parent0e154c74931b6ff5ad6e0ec512b32e30df3cb068 (diff)
downloadidea-c6218e46d5d2017e987ecdbd99b318a95c42abc0.tar.gz
Snapshot d8891a7de15cebb78b6ce5711e50e531b42c0baf from master branch of git://git.jetbrains.org/idea/community.git
Change-Id: Ida9d1b0a2341112b9ebcf67bf560c8f62f0afdc6
Diffstat (limited to 'java/java-impl/src/com/intellij/codeInsight/daemon')
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java7
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java21
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java1
-rw-r--r--java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java1
4 files changed, 8 insertions, 22 deletions
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java b/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
index e411fc11add3..e79fdbe14ed9 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/JavaAwareInspectionProfileCoverter.java
@@ -20,8 +20,9 @@
*/
package com.intellij.codeInsight.daemon;
+import com.intellij.codeInspection.InspectionProfileEntry;
import com.intellij.codeInspection.ModifiableModel;
-import com.intellij.codeInspection.ex.InspectionToolWrapper;
+import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.javaDoc.JavaDocLocalInspection;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import org.jdom.Element;
@@ -52,8 +53,8 @@ public class JavaAwareInspectionProfileCoverter extends InspectionProfileConvert
super.fillErrorLevels(profile);
//javadoc attributes
- final InspectionToolWrapper toolWrapper = (InspectionToolWrapper)profile.getInspectionTool(JavaDocLocalInspection.SHORT_NAME, null);
- JavaDocLocalInspection inspection = (JavaDocLocalInspection)toolWrapper.getTool();
+ final InspectionProfileEntry inspectionTool = profile.getInspectionTool(JavaDocLocalInspection.SHORT_NAME, null);
+ JavaDocLocalInspection inspection = (JavaDocLocalInspection)((LocalInspectionToolWrapper)inspectionTool).getTool();
inspection.myAdditionalJavadocTags = myAdditionalJavadocTags;
}
} \ No newline at end of file
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
index 5bcc31079aab..4f6f0996ad29 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/HighlightClassUtil.java
@@ -94,32 +94,19 @@ public class HighlightClassUtil {
static HighlightInfo checkClassWithAbstractMethods(PsiClass aClass, PsiElement implementsFixElement, TextRange range) {
PsiMethod abstractMethod = ClassUtil.getAnyAbstractMethod(aClass);
- if (abstractMethod == null) {
+ if (abstractMethod == null || abstractMethod.getContainingClass() == null) {
return null;
}
-
- final PsiClass superClass = abstractMethod.getContainingClass();
- if (superClass == null) {
- return null;
- }
-
String baseClassName = HighlightUtil.formatClass(aClass, false);
String methodName = JavaHighlightUtil.formatMethod(abstractMethod);
String message = JavaErrorMessages.message(aClass instanceof PsiEnumConstantInitializer || implementsFixElement instanceof PsiEnumConstant ? "enum.constant.should.implement.method" : "class.must.be.abstract",
baseClassName,
methodName,
- HighlightUtil.formatClass(superClass, false));
+ HighlightUtil.formatClass(abstractMethod.getContainingClass(), false));
HighlightInfo errorResult = HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(range).descriptionAndTooltip(message).create();
- final PsiMethod anyMethodToImplement = ClassUtil.getAnyMethodToImplement(aClass);
- if (anyMethodToImplement != null) {
- if (!anyMethodToImplement.hasModifierProperty(PsiModifier.PACKAGE_LOCAL) ||
- JavaPsiFacade.getInstance(aClass.getProject()).arePackagesTheSame(aClass, superClass)) {
- QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createImplementMethodsFix(implementsFixElement));
- } else {
- QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createModifierListFix(anyMethodToImplement, PsiModifier.PROTECTED, true, true));
- QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createModifierListFix(anyMethodToImplement, PsiModifier.PUBLIC, true, true));
- }
+ if (ClassUtil.getAnyMethodToImplement(aClass) != null) {
+ QuickFixAction.registerQuickFixAction(errorResult, QUICK_FIX_FACTORY.createImplementMethodsFix(implementsFixElement));
}
if (!(aClass instanceof PsiAnonymousClass)
&& HighlightUtil.getIncompatibleModifier(PsiModifier.ABSTRACT, aClass.getModifierList()) == null) {
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
index 2e23f7ef65e4..a2bebf63ac18 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFix.java
@@ -107,7 +107,6 @@ public class ImportClassFix extends ImportClassFixBase<PsiJavaCodeReferenceEleme
return super.getRequiredMemberName(reference);
}
- @NotNull
@Override
protected List<PsiClass> filterByContext(@NotNull List<PsiClass> candidates, @NotNull PsiJavaCodeReferenceElement ref) {
PsiElement typeElement = ref.getParent();
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
index bfb7c45bf3c8..e34ad1820c89 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/ImportClassFixBase.java
@@ -184,7 +184,6 @@ public abstract class ImportClassFixBase<T extends PsiElement, R extends PsiRefe
return null;
}
- @NotNull
protected List<PsiClass> filterByContext(@NotNull List<PsiClass> candidates, @NotNull T ref) {
return candidates;
}