From 0e0710b1d790d3cce80e92a5dfba3fff57fb56ee Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Wed, 18 Sep 2019 12:01:16 +0200 Subject: [PATCH] Don't type annotate initializing formals --- .../amq_plain_authenticator.dart | 2 +- .../authentication/plain_authenticator.dart | 2 +- lib/src/client/connection_settings.dart | 18 +++++++++--------- lib/src/client/impl/amqp_message_impl.dart | 3 +-- lib/src/client/impl/channel_impl.dart | 2 +- lib/src/client/impl/consumer_impl.dart | 5 ++++- lib/src/client/impl/exchange_impl.dart | 2 +- lib/src/client/impl/queue_impl.dart | 2 +- lib/src/exceptions/connection_exception.dart | 8 ++++++-- .../connection_failed_exception.dart | 2 +- lib/src/exceptions/fatal_exception.dart | 2 +- .../frame/impl/decoded_message_impl.dart | 2 +- .../frame/impl/heartbeat_frame_impl.dart | 2 +- lib/src/protocol/frame/raw_frame.dart | 2 +- lib/src/protocol/io/frame_writer.dart | 2 +- lib/src/protocol/stream/type_decoder.dart | 2 +- 16 files changed, 32 insertions(+), 26 deletions(-) diff --git a/lib/src/authentication/amq_plain_authenticator.dart b/lib/src/authentication/amq_plain_authenticator.dart index 2421970..a9a34f5 100644 --- a/lib/src/authentication/amq_plain_authenticator.dart +++ b/lib/src/authentication/amq_plain_authenticator.dart @@ -5,7 +5,7 @@ class AmqPlainAuthenticator implements Authenticator { final String password; /// Create a new [PlainAuthenticator] with the specified [userName] and [password] - const AmqPlainAuthenticator(String this.userName, String this.password); + const AmqPlainAuthenticator(this.userName, this.password); /// Get the class of this authenticator String get saslType => "AMQPLAIN"; diff --git a/lib/src/authentication/plain_authenticator.dart b/lib/src/authentication/plain_authenticator.dart index 63d9767..1028af3 100644 --- a/lib/src/authentication/plain_authenticator.dart +++ b/lib/src/authentication/plain_authenticator.dart @@ -5,7 +5,7 @@ class PlainAuthenticator implements Authenticator { final String password; /// Create a new [PlainAuthenticator] with the specified [userName] and [password] - const PlainAuthenticator(String this.userName, String this.password); + const PlainAuthenticator(this.userName, this.password); /// Get the class of this authenticator String get saslType => "PLAIN"; diff --git a/lib/src/client/connection_settings.dart b/lib/src/client/connection_settings.dart index 37c53d2..958978e 100644 --- a/lib/src/client/connection_settings.dart +++ b/lib/src/client/connection_settings.dart @@ -28,15 +28,15 @@ class ConnectionSettings { // Tuning settings TuningSettings tuningSettings; - ConnectionSettings( - {String this.host = "127.0.0.1", - int this.port = 5672, - String this.virtualHost = "/", - Authenticator this.authProvider = - const PlainAuthenticator("guest", "guest"), - int this.maxConnectionAttempts = 1, - Duration this.reconnectWaitTime = const Duration(milliseconds: 1500), - TuningSettings this.tuningSettings}) { + ConnectionSettings({ + this.host = "127.0.0.1", + this.port = 5672, + this.virtualHost = "/", + this.authProvider = const PlainAuthenticator("guest", "guest"), + this.maxConnectionAttempts = 1, + this.reconnectWaitTime = const Duration(milliseconds: 1500), + this.tuningSettings, + }) { if (this.tuningSettings == null) { tuningSettings = TuningSettings(); } diff --git a/lib/src/client/impl/amqp_message_impl.dart b/lib/src/client/impl/amqp_message_impl.dart index c2bf4c0..ea3f5e6 100644 --- a/lib/src/client/impl/amqp_message_impl.dart +++ b/lib/src/client/impl/amqp_message_impl.dart @@ -6,8 +6,7 @@ class _AmqpMessageImpl implements AmqpMessage { MessageProperties get properties => message.properties; - _AmqpMessageImpl.fromDecodedMessage( - _ConsumerImpl this.consumer, DecodedMessage this.message); + _AmqpMessageImpl.fromDecodedMessage(this.consumer, this.message); Uint8List get payload => message.payload; diff --git a/lib/src/client/impl/channel_impl.dart b/lib/src/client/impl/channel_impl.dart index 92301b9..2e40a4f 100644 --- a/lib/src/client/impl/channel_impl.dart +++ b/lib/src/client/impl/channel_impl.dart @@ -15,7 +15,7 @@ class _ChannelImpl implements Channel { Exception _channelCloseException; final _basicReturnStream = StreamController.broadcast(); - _ChannelImpl(this.channelId, _ClientImpl this._client) { + _ChannelImpl(this.channelId, this._client) { _frameWriter = FrameWriter(_client.tuningSettings); _pendingOperations = ListQueue(); _pendingOperationPayloads = ListQueue(); diff --git a/lib/src/client/impl/consumer_impl.dart b/lib/src/client/impl/consumer_impl.dart index 437e1ec..1255b60 100644 --- a/lib/src/client/impl/consumer_impl.dart +++ b/lib/src/client/impl/consumer_impl.dart @@ -9,7 +9,10 @@ class _ConsumerImpl implements Consumer { String get tag => _tag; _ConsumerImpl( - _ChannelImpl this.channel, _QueueImpl this.queue, String this._tag); + this.channel, + this.queue, + this._tag, + ); StreamSubscription listen(void onData(AmqpMessage event), {Function onError, void onDone(), bool cancelOnError}) => diff --git a/lib/src/client/impl/exchange_impl.dart b/lib/src/client/impl/exchange_impl.dart index 98b33fb..688804d 100644 --- a/lib/src/client/impl/exchange_impl.dart +++ b/lib/src/client/impl/exchange_impl.dart @@ -5,7 +5,7 @@ class _ExchangeImpl implements Exchange { final ExchangeType type; final _ChannelImpl channel; - _ExchangeImpl(_ChannelImpl this.channel, this._name, this.type); + _ExchangeImpl(this.channel, this._name, this.type); String get name => _name; diff --git a/lib/src/client/impl/queue_impl.dart b/lib/src/client/impl/queue_impl.dart index f772e2e..0584e60 100644 --- a/lib/src/client/impl/queue_impl.dart +++ b/lib/src/client/impl/queue_impl.dart @@ -6,7 +6,7 @@ class _QueueImpl implements Queue { int _consumerCount; final _ChannelImpl channel; - _QueueImpl(_ChannelImpl this.channel, this._name); + _QueueImpl(this.channel, this._name); String get name => _name; diff --git a/lib/src/exceptions/connection_exception.dart b/lib/src/exceptions/connection_exception.dart index c727231..01d6f0e 100644 --- a/lib/src/exceptions/connection_exception.dart +++ b/lib/src/exceptions/connection_exception.dart @@ -6,8 +6,12 @@ class ConnectionException implements Exception { final int classId; final int methodId; - ConnectionException(String this.message, ErrorType this.errorType, - int this.classId, int this.methodId); + ConnectionException( + this.message, + this.errorType, + this.classId, + this.methodId, + ); String toString() { return "ConnectionException(${ErrorType.nameOf(errorType)}): ${message}"; diff --git a/lib/src/exceptions/connection_failed_exception.dart b/lib/src/exceptions/connection_failed_exception.dart index 897abf0..85bfb60 100644 --- a/lib/src/exceptions/connection_failed_exception.dart +++ b/lib/src/exceptions/connection_failed_exception.dart @@ -3,7 +3,7 @@ part of dart_amqp.exceptions; class ConnectionFailedException implements Exception { final String message; - ConnectionFailedException(String this.message); + ConnectionFailedException(this.message); String toString() { return "ConnectionFailedException: ${message}"; diff --git a/lib/src/exceptions/fatal_exception.dart b/lib/src/exceptions/fatal_exception.dart index 8539dad..1d83581 100644 --- a/lib/src/exceptions/fatal_exception.dart +++ b/lib/src/exceptions/fatal_exception.dart @@ -3,7 +3,7 @@ part of dart_amqp.exceptions; class FatalException implements Exception { final String message; - FatalException(String this.message); + FatalException(this.message); String toString() { return "FatalException: ${message}"; diff --git a/lib/src/protocol/frame/impl/decoded_message_impl.dart b/lib/src/protocol/frame/impl/decoded_message_impl.dart index f6e658f..2d0073c 100644 --- a/lib/src/protocol/frame/impl/decoded_message_impl.dart +++ b/lib/src/protocol/frame/impl/decoded_message_impl.dart @@ -7,7 +7,7 @@ class DecodedMessageImpl implements DecodedMessage { ChunkedOutputWriter payloadBuffer; Uint8List payload; - DecodedMessageImpl(this.channel, Message this.message); + DecodedMessageImpl(this.channel, this.message); MessageProperties get properties => contentHeader?.properties; diff --git a/lib/src/protocol/frame/impl/heartbeat_frame_impl.dart b/lib/src/protocol/frame/impl/heartbeat_frame_impl.dart index 087b6eb..b973e0d 100644 --- a/lib/src/protocol/frame/impl/heartbeat_frame_impl.dart +++ b/lib/src/protocol/frame/impl/heartbeat_frame_impl.dart @@ -3,7 +3,7 @@ part of dart_amqp.protocol; class HeartbeatFrameImpl implements DecodedMessage { final int channel; - HeartbeatFrameImpl(int this.channel); + HeartbeatFrameImpl(this.channel); // String toString() { // StringBuffer sb = new StringBuffer(""" diff --git a/lib/src/protocol/frame/raw_frame.dart b/lib/src/protocol/frame/raw_frame.dart index 7193c23..5f9cdc8 100644 --- a/lib/src/protocol/frame/raw_frame.dart +++ b/lib/src/protocol/frame/raw_frame.dart @@ -4,7 +4,7 @@ class RawFrame { final FrameHeader header; final ByteData payload; - RawFrame(FrameHeader this.header, ByteData this.payload); + RawFrame(this.header, this.payload); // String toString() { // return """ diff --git a/lib/src/protocol/io/frame_writer.dart b/lib/src/protocol/io/frame_writer.dart index 82df92d..f779efe 100644 --- a/lib/src/protocol/io/frame_writer.dart +++ b/lib/src/protocol/io/frame_writer.dart @@ -11,7 +11,7 @@ class FrameWriter { final TuningSettings _tuningSettings; - FrameWriter(TuningSettings this._tuningSettings) + FrameWriter(this._tuningSettings) : _frameHeader = FrameHeader(), _contentHeader = ContentHeader(), _bufferEncoder = TypeEncoder(), diff --git a/lib/src/protocol/stream/type_decoder.dart b/lib/src/protocol/stream/type_decoder.dart index b142ce8..ee61aa9 100644 --- a/lib/src/protocol/stream/type_decoder.dart +++ b/lib/src/protocol/stream/type_decoder.dart @@ -5,7 +5,7 @@ class TypeDecoder { ByteData _buffer; final Endian endianess = Endian.big; - TypeDecoder.fromBuffer(ByteData this._buffer); + TypeDecoder.fromBuffer(this._buffer); int readInt8() { return _buffer.getInt8(_offset++);