leaks in AddAnnotationFix

This commit is contained in:
Alexey Kudravtsev
2011-04-15 09:40:36 +04:00
parent 891dea62bd
commit a1aeacd499
20 changed files with 389 additions and 226 deletions

View File

@@ -1,9 +1,10 @@
package com.intellij.codeInsight.daemon.quickFix;
import com.intellij.codeInspection.AnnotateMethodFix;
import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.nullable.NullableStuffInspection;
import com.intellij.psi.PsiMethod;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiMethod;
import org.jetbrains.annotations.NonNls;
public class AnnotateMethodTest extends LightQuickFix15TestCase {
@@ -18,14 +19,20 @@ public class AnnotateMethodTest extends LightQuickFix15TestCase {
protected LocalInspectionTool[] configureLocalInspectionTools() {
return new LocalInspectionTool[]{new NullableStuffInspection(){
@Override
protected int annotateBaseMethod(final PsiMethod method, final PsiMethod superMethod, final Project project) {
@NonNls String name = method.getName();
int ret = name.startsWith("annotateBase") ? 0 // yes, annotate all
: name.startsWith("dontAnnotateBase") ? 1 // do not annotate base
: 2; //abort
myMustBeAvailableAfterInvoke = ret == 2;
return ret;
protected AnnotateMethodFix createAnnotateMethodFix(String defaultNotNull, String[] annotationsToRemove) {
return new AnnotateMethodFix(defaultNotNull, annotationsToRemove){
@Override
public int annotateBaseMethod(final PsiMethod method, final PsiMethod superMethod, final Project project) {
@NonNls String name = method.getName();
int ret = name.startsWith("annotateBase") ? 0 // yes, annotate all
: name.startsWith("dontAnnotateBase") ? 1 // do not annotate base
: 2; //abort
myMustBeAvailableAfterInvoke = ret == 2;
return ret;
}
};
}
}};
}