Skip to content

Commit 57c4da6

Browse files
srawlinsCommit Queue
authored andcommitted
Make Driver.instrumentationService private and final
Change-Id: I903c293771c6666e5f1b0f7dc2637abc51943849 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/401580 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent f934e39 commit 57c4da6

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

pkg/analysis_server/lib/src/server/driver.dart

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class Driver implements ServerStarter {
141141
DetachableFileSystemManager? detachableFileSystemManager;
142142

143143
/// The instrumentation service that is to be used by the analysis server.
144-
InstrumentationService? instrumentationService;
144+
late final InstrumentationService _instrumentationService;
145145

146146
/// Use the given command-line [arguments] to start this server.
147147
///
@@ -270,10 +270,7 @@ class Driver implements ServerStarter {
270270
var logFilePath =
271271
results.option(PROTOCOL_TRAFFIC_LOG) ??
272272
results.option(PROTOCOL_TRAFFIC_LOG_ALIAS);
273-
var allInstrumentationServices =
274-
this.instrumentationService == null
275-
? <InstrumentationService>[]
276-
: [this.instrumentationService!];
273+
var allInstrumentationServices = <InstrumentationService>[];
277274
if (logFilePath != null) {
278275
_rollLogFiles(logFilePath, 5);
279276
allInstrumentationServices.add(
@@ -289,21 +286,20 @@ class Driver implements ServerStarter {
289286
allInstrumentationServices.add(
290287
CrashReportingInstrumentation(crashReportSender),
291288
);
292-
var instrumentationService = MulticastInstrumentationService(
289+
_instrumentationService = MulticastInstrumentationService(
293290
allInstrumentationServices,
294291
);
295-
this.instrumentationService = instrumentationService;
296292

297-
instrumentationService.logVersion(
293+
_instrumentationService.logVersion(
298294
results.option(TRAIN_USING) != null
299295
? 'training-0'
300-
: _readUuid(instrumentationService),
296+
: _readUuid(_instrumentationService),
301297
analysisServerOptions.clientId ?? '',
302298
analysisServerOptions.clientVersion ?? '',
303299
PROTOCOL_VERSION,
304300
defaultSdk.languageVersion.toString(),
305301
);
306-
AnalysisEngine.instance.instrumentationService = instrumentationService;
302+
AnalysisEngine.instance.instrumentationService = _instrumentationService;
307303

308304
int? diagnosticServerPort;
309305
var portValue =
@@ -335,7 +331,7 @@ class Driver implements ServerStarter {
335331
analysisServerOptions,
336332
dartSdkManager,
337333
analyticsManager,
338-
instrumentationService,
334+
_instrumentationService,
339335
diagnosticServerPort,
340336
errorNotifier,
341337
);
@@ -347,7 +343,7 @@ class Driver implements ServerStarter {
347343
dartSdkManager,
348344
analyticsManager,
349345
crashReportingAttachmentsBuilder,
350-
instrumentationService,
346+
_instrumentationService,
351347
RequestStatisticsHelper(),
352348
diagnosticServerPort,
353349
errorNotifier,

pkg/analysis_server/lib/starter.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import 'dart:isolate';
77
import 'package:analysis_server/src/server/crash_reporting_attachments.dart';
88
import 'package:analysis_server/src/server/detachable_filesystem_manager.dart';
99
import 'package:analysis_server/src/server/driver.dart';
10-
import 'package:analyzer/instrumentation/instrumentation.dart';
1110

1211
/// An object that can be used to start an analysis server. This class exists so
1312
/// that clients can configure an analysis server before starting it.
@@ -27,10 +26,6 @@ abstract class ServerStarter {
2726
/// available.
2827
set detachableFileSystemManager(DetachableFileSystemManager manager);
2928

30-
/// Set the instrumentation [service] that is to be used by the analysis
31-
/// server.
32-
set instrumentationService(InstrumentationService service);
33-
3429
/// Use the given command-line [arguments] to start this server.
3530
void start(
3631
List<String> arguments, {

0 commit comments

Comments
 (0)