bulk fix for `prefer_const_declarations`

Change-Id: I5ee65d901d8777df032f447b8a56bf1d654b98f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 99689b0..09dd636 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -40,6 +40,7 @@
 import 'package:analysis_server/src/services/correction/dart/rename_to_camel_case.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_cascade_with_dot.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_colon_with_equals.dart';
+import 'package:analysis_server/src/services/correction/dart/replace_final_with_const.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_null_with_closure.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_with_conditional_assignment.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_with_is_empty.dart';
@@ -87,6 +88,7 @@
     LintNames.prefer_adjacent_string_concatenation: RemoveOperator.newInstance,
     LintNames.prefer_conditional_assignment:
         ReplaceWithConditionalAssignment.newInstance,
+    LintNames.prefer_const_declarations: ReplaceFinalWithConst.newInstance,
     LintNames.prefer_contains: ConvertToContains.newInstance,
     LintNames.prefer_equal_for_default_values:
         ReplaceColonWithEquals.newInstance,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart
new file mode 100644
index 0000000..1eefe84
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/replace_final_with_const_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'bulk_fix_processor.dart';
+
+void main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(ReplaceFinalWithConstTest);
+  });
+}
+
+@reflectiveTest
+class ReplaceFinalWithConstTest extends BulkFixProcessorTest {
+  @override
+  String get lintCode => LintNames.prefer_const_declarations;
+
+  Future<void> test_singleFile() async {
+    await resolveTestUnit('''
+final int a = 1;
+final b = 1;
+''');
+    await assertHasFix('''
+const int a = 1;
+const b = 1;
+''');
+  }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
index 328aba0..169e7b5 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
@@ -41,6 +41,7 @@
 import 'remove_unnecessary_new_test.dart' as remove_unnecessary_new;
 import 'rename_to_camel_case_test.dart' as rename_to_camel_case;
 import 'replace_colon_with_equals_test.dart' as replace_colon_with_equals;
+import 'replace_final_with_const_test.dart' as replace_final_with_const;
 import 'replace_null_with_closure_test.dart' as replace_null_with_closure;
 import 'replace_with_conditional_assignment_test.dart'
     as replace_with_conditional_assignment;
@@ -87,6 +88,7 @@
     rename_to_camel_case.main();
     replace_with_conditional_assignment.main();
     replace_colon_with_equals.main();
+    replace_final_with_const.main();
     replace_null_with_closure.main();
     replace_with_is_empty.main();
     replace_with_tear_off.main();