From 38dfabb827c36863a4746edea6bac563aab7ef5c Mon Sep 17 00:00:00 2001 From: Natalie Weizenbaum <nweiz@google.com> Date: Mon, 2 May 2016 14:48:23 -0700 Subject: [PATCH] Fix all strong-mode warnings. --- .analysis_options | 2 ++ CHANGELOG.md | 4 ++++ lib/src/directory_watcher/linux.dart | 6 +++--- lib/src/utils.dart | 11 +++++++---- pubspec.yaml | 3 ++- 5 files changed, 18 insertions(+), 8 deletions(-) create mode 100644 .analysis_options diff --git a/.analysis_options b/.analysis_options new file mode 100644 index 0000000..a10d4c5 --- /dev/null +++ b/.analysis_options @@ -0,0 +1,2 @@ +analyzer: + strong-mode: true diff --git a/CHANGELOG.md b/CHANGELOG.md index 30762a0..dc0b45b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9.7+1 + +* Fix all strong-mode warnings. + # 0.9.7 * Fix a bug in `FileWatcher` where events could be added after watchers were diff --git a/lib/src/directory_watcher/linux.dart b/lib/src/directory_watcher/linux.dart index f327bb0..f33a554 100644 --- a/lib/src/directory_watcher/linux.dart +++ b/lib/src/directory_watcher/linux.dart @@ -128,9 +128,9 @@ class _LinuxDirectoryWatcher /// The callback that's run when a batch of changes comes in. void _onBatch(List<FileSystemEvent> batch) { - var files = new Set(); - var dirs = new Set(); - var changed = new Set(); + var files = new Set<String>(); + var dirs = new Set<String>(); + var changed = new Set<String>(); // inotify event batches are ordered by occurrence, so we treat them as a // log of what happened to a file. We only emit events based on the diff --git a/lib/src/utils.dart b/lib/src/utils.dart index d263f2f..6f3ff02 100644 --- a/lib/src/utils.dart +++ b/lib/src/utils.dart @@ -6,6 +6,8 @@ import 'dart:async'; import 'dart:io'; import 'dart:collection'; +import 'package:async/async.dart'; + /// Returns `true` if [error] is a [FileSystemException] for a missing /// directory. bool isDirectoryNotFoundException(error) { @@ -29,17 +31,18 @@ Set unionAll(Iterable<Set> sets) => /// If [broadcast] is true, a broadcast stream is returned. This assumes that /// the stream returned by [future] will be a broadcast stream as well. /// [broadcast] defaults to false. -Stream futureStream(Future<Stream> future, {bool broadcast: false}) { +Stream/*<T>*/ futureStream/*<T>*/(Future<Stream/*<T>*/> future, + {bool broadcast: false}) { var subscription; - StreamController controller; + StreamController/*<T>*/ controller; - future = future.catchError((e, stackTrace) { + future = DelegatingFuture.typed(future.catchError((e, stackTrace) { // Since [controller] is synchronous, it's likely that emitting an error // will cause it to be cancelled before we call close. if (controller != null) controller.addError(e, stackTrace); if (controller != null) controller.close(); controller = null; - }); + })); onListen() { future.then((stream) { diff --git a/pubspec.yaml b/pubspec.yaml index c0152e0..ce64478 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: watcher -version: 0.9.8-dev +version: 0.9.7+1 author: Dart Team <misc@dartlang.org> homepage: https://github.com/dart-lang/watcher description: > @@ -12,6 +12,7 @@ dependencies: collection: '^1.0.0' path: '>=0.9.0 <2.0.0' dev_dependencies: + async: '^1.8.0' benchmark_harness: '^1.0.4' scheduled_test: '^0.12.0' test: '^0.12.0'