quick fix for `ABSTRACT_STATIC_FIELD`
Change-Id: I4311b1d6341432e5e1ccb18d516dc08cf34f7abd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368520
Auto-Submit: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/dart/remove_extra_modifier.dart b/pkg/analysis_server/lib/src/services/correction/dart/remove_extra_modifier.dart
index 2f0b772..2bd6ae3 100644
--- a/pkg/analysis_server/lib/src/services/correction/dart/remove_extra_modifier.dart
+++ b/pkg/analysis_server/lib/src/services/correction/dart/remove_extra_modifier.dart
@@ -36,7 +36,7 @@
var message = problemMessage.messageText(includeUrl: false);
var modifierStart = message.indexOf(" '") + 2;
- var modifierStop = message.indexOf("' ", modifierStart);
+ var modifierStop = message.indexOf("'", modifierStart);
_modifierName = message.substring(modifierStart, modifierStop);
diff --git a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
index 025404c..02acd3e 100644
--- a/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
+++ b/pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml
@@ -45,8 +45,8 @@
#
# Stats:
# - 42 "needsEvaluation"
-# - 358 "needsFix"
-# - 393 "hasFix"
+# - 357 "needsFix"
+# - 394 "hasFix"
# - 516 "noFix"
AnalysisOptionsErrorCode.INCLUDED_FILE_PARSE_ERROR:
@@ -2532,9 +2532,7 @@
notes: |-
Remove either the `abstract` or the `sealed` keyword.
ParserErrorCode.ABSTRACT_STATIC_FIELD:
- status: needsFix
- notes: |-
- Remove the `abstract` keyword.
+ status: hasFix
ParserErrorCode.ABSTRACT_STATIC_METHOD:
status: needsFix
notes: |-
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index d24a336..b76156a 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -1344,6 +1344,9 @@
ParserErrorCode.ABSTRACT_CLASS_MEMBER: [
RemoveAbstract.bulkFixable,
],
+ ParserErrorCode.ABSTRACT_STATIC_FIELD: [
+ RemoveExtraModifier.new,
+ ],
ParserErrorCode.CONST_CLASS: [
RemoveConst.new,
],
diff --git a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
index e53ea64..a43be13 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/remove_extra_modifier_test.dart
@@ -51,6 +51,19 @@
@override
FixKind get kind => DartFixKind.REMOVE_EXTRA_MODIFIER;
+ Future<void> test_abstract_static_field() async {
+ await resolveTestCode('''
+abstract class A {
+ abstract static int? i;
+}
+''');
+ await assertHasFix('''
+abstract class A {
+ static int? i;
+}
+''');
+ }
+
Future<void> test_abstractEnum() async {
await resolveTestCode(r'''
abstract enum E {ONE}