Skip to content

Commit c4f448d

Browse files
committed
Replace usages of @Sealed annotation
1 parent 591b8b2 commit c4f448d

File tree

11 files changed

+23
-51
lines changed

11 files changed

+23
-51
lines changed

app/lib/fake/backend/fake_pub_worker.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import 'package:gcloud/service_scope.dart';
1515
import 'package:http/http.dart';
1616
import 'package:http_parser/http_parser.dart';
1717
import 'package:indexed_blob/indexed_blob.dart';
18-
import 'package:meta/meta.dart';
1918
import 'package:pana/pana.dart';
2019
import 'package:path/path.dart' as p;
2120
import 'package:pub_dev/fake/backend/fake_pana_runner.dart';
@@ -303,8 +302,7 @@ Future<void> _upload(
303302
);
304303
}, retryIf: (e) => e is IOException || e is IntermittentUploadException);
305304

306-
@sealed
307-
class UploadException implements Exception {
305+
final class UploadException implements Exception {
308306
final String message;
309307

310308
UploadException(this.message);
@@ -313,8 +311,7 @@ class UploadException implements Exception {
313311
String toString() => message;
314312
}
315313

316-
@sealed
317-
class IntermittentUploadException extends UploadException {
314+
final class IntermittentUploadException extends UploadException {
318315
IntermittentUploadException(String message) : super(message);
319316
}
320317

app/lib/shared/configuration.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,13 @@ const _fakeExternalAudience = 'https://pub.dev';
4747
/// The configuration define the location of the Datastore with the
4848
/// package metadata and the Cloud Storage bucket for the actual package
4949
/// tar files.
50-
@sealed
5150
@JsonSerializable(
5251
anyMap: true,
5352
explicitToJson: true,
5453
checked: true,
5554
disallowUnrecognizedKeys: true,
5655
)
57-
class Configuration {
56+
final class Configuration {
5857
/// The name of the Cloud Storage bucket to use for storing the uploaded
5958
/// package archives.
6059
///

app/lib/task/cloudcompute/cloudcompute.dart

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'package:meta/meta.dart';
6-
75
/// Interface describing an instance.
86
abstract class CloudInstance {
97
/// Unique instance name.
@@ -105,11 +103,10 @@ abstract class CloudCompute {
105103
///
106104
/// The caller is expected to back-off using the zone for a while before trying
107105
/// to create new VMs in the zone again.
108-
@sealed
109-
class ZoneExhaustedException implements Exception {
106+
final class ZoneExhaustedException implements Exception {
110107
final String zone;
111-
112108
final String message;
109+
113110
ZoneExhaustedException(this.zone, this.message);
114111

115112
@override
@@ -121,9 +118,9 @@ class ZoneExhaustedException implements Exception {
121118
///
122119
/// The caller is expected to back-off for a while before trying to create
123120
/// new VMs.
124-
@sealed
125-
class QuotaExhaustedException implements Exception {
121+
final class QuotaExhaustedException implements Exception {
126122
final String message;
123+
127124
QuotaExhaustedException(this.message);
128125

129126
@override

app/lib/task/cloudcompute/fakecloudcompute.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import 'dart:io';
88
import 'package:clock/clock.dart';
99
import 'package:collection/collection.dart';
1010
import 'package:logging/logging.dart';
11-
import 'package:meta/meta.dart';
1211
import 'package:path/path.dart' as p;
1312
import 'package:pub_dev/frontend/static_files.dart';
1413

@@ -18,8 +17,7 @@ final _log = Logger('pub.fakecloudcompute');
1817

1918
typedef InstanceRunner = Future<void> Function(FakeCloudInstance instance);
2019

21-
@sealed
22-
class FakeCloudCompute extends CloudCompute {
20+
final class FakeCloudCompute extends CloudCompute {
2321
var _nextInstanceId = 1;
2422
final _instances = <FakeCloudInstance>{};
2523
final InstanceRunner _instanceRunner;
@@ -221,8 +219,7 @@ Future<void> _defaultInstanceRunner(FakeCloudInstance instance) async {
221219
_log.info('pub_worker exit code: $exitCode');
222220
}
223221

224-
@sealed
225-
class FakeCloudInstance extends CloudInstance {
222+
final class FakeCloudInstance extends CloudInstance {
226223
@override
227224
final String instanceName;
228225

app/lib/task/cloudcompute/googlecloudcompute.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import 'package:googleapis/compute/v1.dart' hide Duration;
1212
import 'package:googleapis/compute/v1.dart' as compute_v1 show Duration;
1313
import 'package:http/http.dart' as http;
1414
import 'package:logging/logging.dart' show Logger;
15-
import 'package:meta/meta.dart';
1615
import 'package:pub_dev/shared/utils.dart' show createUuid;
1716
import 'package:pub_dev/task/cloudcompute/cloudcompute.dart';
1817
import 'package:retry/retry.dart';
@@ -221,7 +220,7 @@ Future<void> deleteAbandonedInstances({
221220
}
222221
}
223222

224-
class _GoogleCloudInstance extends CloudInstance {
223+
final class _GoogleCloudInstance extends CloudInstance {
225224
/// GCP zone this instance exists inside.
226225
@override
227226
final String zone;
@@ -248,7 +247,7 @@ class _GoogleCloudInstance extends CloudInstance {
248247
}
249248
}
250249

251-
class _PendingGoogleCloudInstance extends CloudInstance {
250+
final class _PendingGoogleCloudInstance extends CloudInstance {
252251
/// GCP zone this instance exists inside.
253252
@override
254253
final String zone;
@@ -304,8 +303,7 @@ final _validInstanceNamePattern = RegExp(r'^[a-z]([-a-z0-9]*[a-z0-9])?$');
304303
String _shellSingleQuote(String string) =>
305304
"'${string.replaceAll("'", "'\\''")}'";
306305

307-
@sealed
308-
class _GoogleCloudCompute extends CloudCompute {
306+
final class _GoogleCloudCompute extends CloudCompute {
309307
final ComputeApi _api;
310308

311309
/// GCP project this instance is managing VMs inside.

app/test/task/fake_time.dart

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'dart:math';
77

88
import 'package:clock/clock.dart';
99
import 'package:collection/collection.dart';
10-
import 'package:meta/meta.dart' show sealed;
1110

1211
// TODO(jonasfj): Document this concept, maybe give it a better name and see if
1312
// we can publish it as a separate package. Maybe, it should be
@@ -16,8 +15,7 @@ import 'package:meta/meta.dart' show sealed;
1615
// Or something else clever, without being too clever!
1716
// Or maybe we should rename _TravelingTimer to _FakeTimer.
1817

19-
@sealed
20-
abstract class FakeTime {
18+
abstract final class FakeTime {
2119
FakeTime._();
2220

2321
Future<void> elapse({
@@ -88,7 +86,7 @@ abstract class FakeTime {
8886
}
8987
}
9088

91-
class _FakeTime extends FakeTime {
89+
final class _FakeTime extends FakeTime {
9290
final DateTime Function() _originalTime;
9391
Duration _offset;
9492

pkg/_pub_shared/lib/data/task_payload.dart

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@
55
import 'dart:collection';
66

77
import 'package:json_annotation/json_annotation.dart';
8-
import 'package:meta/meta.dart';
98

109
part 'task_payload.g.dart';
1110

1211
/// JSON payload given as single argument to the `pub_worker.dart` command.
13-
@sealed
1412
@JsonSerializable()
15-
class Payload {
13+
final class Payload {
1614
/// Package name of the package to be processed.
1715
final String package;
1816

@@ -49,9 +47,8 @@ class Payload {
4947
}
5048

5149
/// Pair of [version] and [token].
52-
@sealed
5350
@JsonSerializable()
54-
class VersionTokenPair {
51+
final class VersionTokenPair {
5552
/// Version of [Payload.package] to be processed.
5653
final String version;
5754

pkg/indexed_blob/lib/indexed_blob.dart

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import 'dart:convert' show utf8;
2323
import 'dart:typed_data';
2424
import 'package:jsontool/jsontool.dart'
2525
show JsonReader, jsonStringWriter, JsonSink;
26-
import 'package:meta/meta.dart';
2726

2827
export 'src/blobindexpair.dart' show BlobIndexPair;
2928

@@ -48,8 +47,7 @@ export 'src/blobindexpair.dart' show BlobIndexPair;
4847
/// // Finish building, and create the index
4948
/// await File('mydata.index').writeBytes();
5049
/// ```
51-
@sealed
52-
class IndexedBlobBuilder {
50+
final class IndexedBlobBuilder {
5351
final StreamSink<List<int>> _blob;
5452
int _offset = 0;
5553
final Map<String, dynamic> _index = {};
@@ -225,8 +223,7 @@ bool _skipUntilKey(JsonReader r, String key) {
225223
/// }
226224
/// ```
227225
///
228-
@sealed
229-
class BlobIndex {
226+
final class BlobIndex {
230227
final Uint8List _indexFile;
231228

232229
/// Create [BlobIndex] from [indexFile] contents.
@@ -411,8 +408,7 @@ class BlobIndex {
411408
}
412409

413410
/// Range of a file in an indexed-blob.
414-
@sealed
415-
class FileRange {
411+
final class FileRange {
416412
/// Path that was looked up in [BlobIndex].
417413
final String path;
418414

pkg/indexed_blob/lib/src/blobindexpair.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,11 @@ import 'dart:io' show Directory, File, gzip;
77
import 'dart:typed_data' show Uint8List;
88

99
import 'package:async/async.dart';
10-
import 'package:meta/meta.dart';
1110
import 'package:path/path.dart' as p;
1211
import '../indexed_blob.dart' show IndexedBlobBuilder, BlobIndex;
1312

1413
/// Pair containing and in-memory [blob] and matching [index].
15-
@sealed
16-
class BlobIndexPair {
14+
final class BlobIndexPair {
1715
/// Blob indexed by [index].
1816
final Uint8List blob;
1917

pkg/pub_worker/lib/src/sdks.dart

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,10 @@
55
import 'dart:io';
66

77
import 'package:collection/collection.dart';
8-
import 'package:meta/meta.dart';
98
import 'package:path/path.dart' as p;
109
import 'package:pub_semver/pub_semver.dart' show Version;
1110

12-
@sealed
13-
class InstalledSdk {
11+
final class InstalledSdk {
1412
final String kind;
1513
final String path;
1614
final Version version;

0 commit comments

Comments
 (0)