mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
leaking highlighting session fixed
This commit is contained in:
+20
-14
@@ -26,22 +26,28 @@ public class DefaultAnnotationParamInspection extends AbstractBaseJavaLocalInspe
|
||||
PsiAnnotationMemberValue defaultValue = ((PsiAnnotationMethod)element).getDefaultValue();
|
||||
if (defaultValue == null) return;
|
||||
if (AnnotationUtil.equal(value, defaultValue)) {
|
||||
holder.registerProblem(value, "Redundant default parameter value assignment", ProblemHighlightType.LIKE_UNUSED_SYMBOL, new LocalQuickFix() {
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Remove redundant parameter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PsiElement parent = descriptor.getPsiElement().getParent();
|
||||
parent.delete();
|
||||
}
|
||||
});
|
||||
holder.registerProblem(value, "Redundant default parameter value assignment", ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
createRemoveParameterFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static LocalQuickFix createRemoveParameterFix() {
|
||||
return new LocalQuickFix() {
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Remove redundant parameter";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
PsiElement parent = descriptor.getPsiElement().getParent();
|
||||
parent.delete();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+22
-17
@@ -32,11 +32,11 @@ import java.util.stream.Stream;
|
||||
public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalInspectionTool implements CleanupLocalInspectionTool{
|
||||
private static final String OVERRIDE_SHORT_NAME = StringUtil.getShortName(CommonClassNames.JAVA_LANG_OVERRIDE);
|
||||
|
||||
@SuppressWarnings({"PublicField"})
|
||||
@SuppressWarnings("PublicField")
|
||||
public boolean ignoreObjectMethods = true;
|
||||
|
||||
@SuppressWarnings({"PublicField"})
|
||||
public boolean ignoreAnonymousClassMethods = false;
|
||||
@SuppressWarnings("PublicField")
|
||||
public boolean ignoreAnonymousClassMethods;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@@ -75,7 +75,7 @@ public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalIn
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated. To be removed in 2019.1.
|
||||
* @deprecated To be removed in 2019.1.
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("unused")
|
||||
@@ -84,7 +84,7 @@ public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalIn
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated. To be removed in 2019.1.
|
||||
* @deprecated To be removed in 2019.1.
|
||||
*/
|
||||
@Deprecated
|
||||
protected BaseInspectionVisitor buildVisitor() {
|
||||
@@ -137,17 +137,7 @@ public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalIn
|
||||
InspectionGadgetsBundle.message(result.requireAnnotation
|
||||
? "missing.override.annotation.problem.descriptor"
|
||||
: "missing.override.annotation.in.overriding.problem.descriptor"),
|
||||
new AnnotateMethodFix(CommonClassNames.JAVA_LANG_OVERRIDE) {
|
||||
@Override
|
||||
protected boolean annotateSelf() {
|
||||
return result.requireAnnotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean annotateOverriddenMethods() {
|
||||
return result.hierarchyAnnotated == ThreeState.NO;
|
||||
}
|
||||
});
|
||||
createAnnotateFix(result.requireAnnotation, result.hierarchyAnnotated));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,8 +226,23 @@ public class MissingOverrideAnnotationInspection extends AbstractBaseJavaLocalIn
|
||||
};
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static AnnotateMethodFix createAnnotateFix(final boolean requireAnnotation, final ThreeState hierarchyAnnotated) {
|
||||
return new AnnotateMethodFix(CommonClassNames.JAVA_LANG_OVERRIDE) {
|
||||
@Override
|
||||
protected boolean annotateSelf() {
|
||||
return requireAnnotation;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean annotateOverriddenMethods() {
|
||||
return hierarchyAnnotated == ThreeState.NO;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private static class InspectionResult {
|
||||
private boolean requireAnnotation = false;
|
||||
private boolean requireAnnotation;
|
||||
private ThreeState hierarchyAnnotated = ThreeState.UNSURE;
|
||||
}
|
||||
|
||||
|
||||
+20
-15
@@ -52,22 +52,27 @@ public class XmlDefaultAttributeValueInspection extends XmlSuppressableInspectio
|
||||
String defaultValue = descriptor.getDefaultValue();
|
||||
if (defaultValue != null && defaultValue.equals(value.getValue())) {
|
||||
holder.registerProblem(value, "Redundant default attribute value assignment", ProblemHighlightType.LIKE_UNUSED_SYMBOL,
|
||||
new LocalQuickFix() {
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return XmlErrorMessages.message("remove.attribute.quickfix.family");
|
||||
}
|
||||
createDeleteFix());
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
XmlAttribute attribute = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), XmlAttribute.class);
|
||||
if (attribute != null) {
|
||||
attribute.delete();
|
||||
}
|
||||
}
|
||||
});
|
||||
@NotNull
|
||||
private static LocalQuickFix createDeleteFix() {
|
||||
return new LocalQuickFix() {
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return XmlErrorMessages.message("remove.attribute.quickfix.family");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
XmlAttribute attribute = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), XmlAttribute.class);
|
||||
if (attribute != null) {
|
||||
attribute.delete();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user