THRIFT-3981 Enable analyzer strong mode in Dart library
Client: Dart
Patch: Mark Erickson <merickson@apache.org>
This closes #1135
diff --git a/lib/dart/.analysis_options b/lib/dart/.analysis_options
new file mode 100644
index 0000000..a10d4c5
--- /dev/null
+++ b/lib/dart/.analysis_options
@@ -0,0 +1,2 @@
+analyzer:
+ strong-mode: true
diff --git a/lib/dart/lib/src/transport/t_http_transport.dart b/lib/dart/lib/src/transport/t_http_transport.dart
index bd821f4..aa78e9c 100644
--- a/lib/dart/lib/src/transport/t_http_transport.dart
+++ b/lib/dart/lib/src/transport/t_http_transport.dart
@@ -75,7 +75,7 @@
final Uri url;
Map<String, String> _headers;
- get headers => _headers;
+ Map<String, String> get headers => _headers;
THttpConfig(this.url, Map<String, String> headers) {
if (url == null || !url.hasAuthority) {
diff --git a/lib/dart/lib/src/transport/t_socket_transport.dart b/lib/dart/lib/src/transport/t_socket_transport.dart
index 824260d..8dcdfde 100644
--- a/lib/dart/lib/src/transport/t_socket_transport.dart
+++ b/lib/dart/lib/src/transport/t_socket_transport.dart
@@ -76,7 +76,7 @@
// Use a sync completer to ensure that the buffer can be read immediately
// after the read buffer is set, and avoid a race condition where another
// response could overwrite the read buffer.
- Completer completer = new Completer.sync();
+ var completer = new Completer<Uint8List>.sync();
_completers.add(completer);
socket.send(bytes);
@@ -123,7 +123,7 @@
// Use a sync completer to ensure that the buffer can be read immediately
// after the read buffer is set, and avoid a race condition where another
// response could overwrite the read buffer.
- Completer completer = new Completer.sync();
+ var completer = new Completer<Uint8List>.sync();
_completers[seqid] = completer;
if (responseTimeout != null) {
diff --git a/lib/dart/pubspec.yaml b/lib/dart/pubspec.yaml
index 53f5450..f7aa876 100644
--- a/lib/dart/pubspec.yaml
+++ b/lib/dart/pubspec.yaml
@@ -22,15 +22,22 @@
author: Apache Thrift Developers <dev@thrift.apache.org>
homepage: http://thrift.apache.org
documentation: http://thrift.apache.org
+
environment:
sdk: ">=1.13.0 <2.0.0"
+
dependencies:
- fixnum: "^0.10.2"
- http: "^0.11.3"
- logging: "^0.11.0"
+ fixnum: ^0.10.2
+ http: ^0.11.3
+ logging: ^0.11.0
+
dev_dependencies:
- coverage: "^0.7.2"
- dart_dev: "^1.0.1"
- dart_style: "^0.2.0"
- mockito: "^0.11.0"
- test: "^0.12.0"
+ # test
+ mockito: ^1.0.0
+ test: ^0.12.0
+
+ # dart_dev - https://github.com/Workiva/dart_dev
+ dart_dev: ^1.5.0
+ coverage: ^0.7.3
+ dart_style: ">=0.2.4 <0.3.0"
+ dartdoc: ^0.9.0
diff --git a/lib/dart/test/serializer/serializer_test_data.dart b/lib/dart/test/serializer/serializer_test_data.dart
index f957e3d..3586f08 100644
--- a/lib/dart/test/serializer/serializer_test_data.dart
+++ b/lib/dart/test/serializer/serializer_test_data.dart
@@ -163,7 +163,7 @@
if (value == null) {
unsetL();
} else {
- this.l = value;
+ this.l = value as List<String>;
}
break;
@@ -339,4 +339,4 @@
// check that fields of type enum have valid values
}
-}
\ No newline at end of file
+}