notnull, cleanup

This commit is contained in:
Alexey Kudravtsev
2013-08-27 13:19:35 +04:00
parent 75b28bae9e
commit 135e250b6f
3 changed files with 27 additions and 36 deletions
@@ -31,38 +31,53 @@ public abstract class QuickFixFactory {
return ServiceManager.getService(QuickFixFactory.class);
}
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierList modifierList,
@PsiModifier.ModifierConstant @NotNull String modifier,
boolean shouldHave,
final boolean showContainingClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierListOwner owner,
@PsiModifier.ModifierConstant @NotNull String modifier,
boolean shouldHave,
final boolean showContainingClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method, @NotNull PsiType toReturn, boolean fixWholeHierarchy);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull PsiMethod method, @NotNull PsiClass toClass);
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull String methodText, @NotNull PsiClass toClass, String... exceptions);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull String methodText, @NotNull PsiClass toClass, @NotNull String... exceptions);
/**
* @param psiElement psiClass or enum constant without class initializer
*/
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiElement psiElement);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiClass psiElement);
@NotNull
public abstract LocalQuickFixOnPsiElement createMethodThrowsFix(@NotNull PsiMethod method, @NotNull PsiClassType exceptionClass, boolean shouldThrow, boolean showContainingClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddDefaultConstructorFix(@NotNull PsiClass aClass);
@Nullable
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddConstructorFix(@NotNull PsiClass aClass, @PsiModifier.ModifierConstant String modifier);
public abstract LocalQuickFixAndIntentionActionOnPsiElement createAddConstructorFix(@NotNull PsiClass aClass, @PsiModifier.ModifierConstant @NotNull String modifier);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMethodParameterTypeFix(@NotNull PsiMethod method, int index, @NotNull PsiType newType, boolean fixWholeHierarchy);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass aClass);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass aClass, final boolean makeInterface);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createExtendsListFix(@NotNull PsiClass aClass, @NotNull PsiClassType typeToExtendFrom, boolean toAdd);
@NotNull
public abstract LocalQuickFixAndIntentionActionOnPsiElement createRemoveUnusedParameterFix(@NotNull PsiParameter parameter);
@NotNull
public abstract IntentionAction createRemoveUnusedVariableFix(@NotNull PsiVariable variable);
@Nullable
public abstract IntentionAction createCreateClassOrPackageFix(@NotNull PsiElement context, @NotNull String qualifiedName, final boolean createClass, final String superClass);
@Nullable
public abstract IntentionAction createCreateClassOrInterfaceFix(@NotNull PsiElement context, @NotNull String qualifiedName, final boolean createClass, final String superClass);
public abstract IntentionAction createCreateFieldOrPropertyFix(final PsiClass aClass, final String name, final PsiType type, final PropertyMemberType targetMember, final PsiAnnotation... annotations);
@NotNull
public abstract IntentionAction createCreateFieldOrPropertyFix(@NotNull PsiClass aClass, @NotNull String name, @NotNull PsiType type, @NotNull PropertyMemberType targetMember, @NotNull PsiAnnotation... annotations);
}
@@ -62,23 +62,14 @@ public final class Annotation implements Segment {
public static class QuickFixInfo {
public final IntentionAction quickFix;
@NotNull
public final TextRange textRange;
public final List<IntentionAction> options;
public final HighlightDisplayKey key;
@Deprecated
public QuickFixInfo(final IntentionAction quickFix, final TextRange textRange, final List<IntentionAction> options, String displayName) {
key = null;
this.quickFix = quickFix;
this.textRange = textRange;
this.options = options;
}
public QuickFixInfo(@NotNull IntentionAction fix, final TextRange range, @Nullable final HighlightDisplayKey key) {
public QuickFixInfo(@NotNull IntentionAction fix, @NotNull TextRange range, @Nullable final HighlightDisplayKey key) {
this.key = key;
quickFix = fix;
textRange = range;
options = null;
}
@Override
@@ -99,7 +90,7 @@ public final class Annotation implements Segment {
* @see AnnotationHolder#createWarningAnnotation
* @see AnnotationHolder#createInfoAnnotation
*/
public Annotation(final int startOffset, final int endOffset, final HighlightSeverity severity, final String message, String tooltip) {
public Annotation(final int startOffset, final int endOffset, @NotNull HighlightSeverity severity, final String message, String tooltip) {
assert startOffset <= endOffset : startOffset + ":" + endOffset;
assert startOffset >= 0 : "Start offset must not be negative: " +startOffset;
myStartOffset = startOffset;
@@ -133,24 +124,6 @@ public final class Annotation implements Segment {
myQuickFixes.add(new QuickFixInfo(new LocalQuickFixAsIntentionAdapter(fix, problemDescriptor), range, key));
}
/**
* Registers a quick fix for the annotation which is only available on a particular range of text
* within the annotation.
*
* @param fix the quick fix implementation.
* @param range the text range (relative to the document) where the quick fix is available.
*/
@Deprecated
public void registerFix(@NotNull IntentionAction fix, TextRange range, List<IntentionAction> options, String displayName) {
if (range == null) {
range = new TextRange(myStartOffset, myEndOffset);
}
if (myQuickFixes == null) {
myQuickFixes = new ArrayList<QuickFixInfo>();
}
myQuickFixes.add(new QuickFixInfo(fix, range, options, displayName));
}
/**
* Registers a quick fix for the annotation which is only available on a particular range of text
* within the annotation.
@@ -242,6 +215,7 @@ public final class Annotation implements Segment {
*
* @return the annotation severity.
*/
@NotNull
public HighlightSeverity getSeverity() {
return mySeverity;
}
@@ -263,6 +237,7 @@ public final class Annotation implements Segment {
*
* @return the text attribute key used for highlighting
*/
@NotNull
public TextAttributesKey getTextAttributes() {
if (myEnforcedAttributesKey != null) return myEnforcedAttributesKey;
@@ -19,13 +19,14 @@
* User: max
* Date: Jun 10, 2002
* Time: 5:54:59 PM
* To change template for new interface use
* To change template for new interface use
* Code Style | Class Templates options (Tools | IDE Options).
*/
package com.intellij.openapi.editor.ex;
import com.intellij.openapi.editor.markup.RangeHighlighter;
import com.intellij.openapi.editor.markup.TextAttributes;
import org.jetbrains.annotations.NotNull;
public interface RangeHighlighterEx extends RangeHighlighter, RangeMarkerEx {
boolean isAfterEndOfLine();
@@ -37,5 +38,5 @@ public interface RangeHighlighterEx extends RangeHighlighter, RangeMarkerEx {
@Override
long getId();
void setTextAttributes(TextAttributes textAttributes);
void setTextAttributes(@NotNull TextAttributes textAttributes);
}