Static constructors has been added for ReplaceCallFix.
This commit is contained in:
@@ -133,9 +133,9 @@ public class QuickFixes {
|
|||||||
actions.put(VAL_WITH_SETTER, changeVariableMutabilityFix);
|
actions.put(VAL_WITH_SETTER, changeVariableMutabilityFix);
|
||||||
actions.put(VAL_REASSIGNMENT, changeVariableMutabilityFix);
|
actions.put(VAL_REASSIGNMENT, changeVariableMutabilityFix);
|
||||||
|
|
||||||
actions.put(UNNECESSARY_SAFE_CALL, new ReplaceCallFix(true, false));
|
actions.put(UNNECESSARY_SAFE_CALL, ReplaceCallFix.toDotCall());
|
||||||
actions.put(UNSAFE_CALL, new ReplaceCallFix(true, true));
|
actions.put(UNSAFE_CALL, ReplaceCallFix.toSafeCall());
|
||||||
actions.put(UNSAFE_CALL, new ReplaceCallFix(false, true));
|
actions.put(UNSAFE_CALL, ReplaceCallFix.toNonNullAssertedCall());
|
||||||
|
|
||||||
actions.put(UNNECESSARY_NOT_NULL_ASSERTION, new UnnecessaryNotNullAssertionFix());
|
actions.put(UNNECESSARY_NOT_NULL_ASSERTION, new UnnecessaryNotNullAssertionFix());
|
||||||
|
|
||||||
|
|||||||
@@ -29,16 +29,38 @@ import org.jetbrains.jet.plugin.JetBundle;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @author svtk
|
* @author svtk
|
||||||
|
* @author slukjanov aka Frostman
|
||||||
*/
|
*/
|
||||||
public class ReplaceCallFix implements IntentionAction {
|
public class ReplaceCallFix implements IntentionAction {
|
||||||
private final boolean safe;
|
private final boolean safe;
|
||||||
private final boolean fromDot;
|
private final boolean fromDot;
|
||||||
|
|
||||||
public ReplaceCallFix(boolean safe, boolean fromDot) {
|
private ReplaceCallFix(boolean safe, boolean fromDot) {
|
||||||
this.safe = safe;
|
this.safe = safe;
|
||||||
this.fromDot = fromDot;
|
this.fromDot = fromDot;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return quickfix for replacing dot call with safe (?.) call
|
||||||
|
*/
|
||||||
|
public static ReplaceCallFix toSafeCall() {
|
||||||
|
return new ReplaceCallFix(true, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return quickfix for replacing dot call with non-null asserted (!!.) call
|
||||||
|
*/
|
||||||
|
public static ReplaceCallFix toNonNullAssertedCall() {
|
||||||
|
return new ReplaceCallFix(false, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return quickfix for replacing unnecessary safe (?.) call with dot call
|
||||||
|
*/
|
||||||
|
public static ReplaceCallFix toDotCall() {
|
||||||
|
return new ReplaceCallFix(true, false);
|
||||||
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public String getText() {
|
public String getText() {
|
||||||
|
|||||||
Reference in New Issue
Block a user