Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 0296286

Browse files
sortiecommit-bot@chromium.org
authored andcommitted
[nnbd] Fix remaining analyzer issues in dart:io and dart:_http.
Change-Id: I419b54962fde1a6bd4efd9ea58d81cf29a8bd45a Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140103 Reviewed-by: Lasse R.H. Nielsen <lrn@google.com> Commit-Queue: Jonas Termansen <sortie@google.com>
1 parent a3499f0 commit 0296286

4 files changed

Lines changed: 34 additions & 33 deletions

File tree

pkg/dev_compiler/tool/dart2js_nnbd_sdk_error_golden.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/i
66
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '>>': int.>> (int Function(int)), JSNumber.>> (num Function(num)).
77
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '\|': int.\| (int Function(int)), JSNumber.\| (num Function(num)).
88
ERROR|COMPILE_TIME_ERROR|INCONSISTENT_INHERITANCE|lib/_internal/js_runtime/lib/interceptors.dart|1637|7|5|Superinterfaces don't have a valid override for '^': int.^ (int Function(int)), JSNumber.^ (num Function(num)).
9-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1010|10|5|Non-nullable instance field 'value' must be initialized.
10-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1036|8|6|Non-nullable instance field 'secure' must be initialized.
11-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1042|8|8|Non-nullable instance field 'httpOnly' must be initialized.
12-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1499|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
13-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1549|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
14-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|172|8|12|Non-nullable instance field 'autoCompress' must be initialized.
15-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|997|10|4|Non-nullable instance field 'name' must be initialized.
16-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.
179
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1654|28|1|The operator '&' isn't defined for the type 'JSInt'.
1810
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1656|27|1|The operator '&' isn't defined for the type 'JSInt'.
1911
ERROR|STATIC_TYPE_WARNING|UNDEFINED_OPERATOR|lib/_internal/js_runtime/lib/interceptors.dart|1659|17|1|The operator '&' isn't defined for the type 'JSInt'.

pkg/dev_compiler/tool/dartdevc_nnbd_sdk_error_golden.txt

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,3 @@ ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runti
1515
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|221|8|37|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
1616
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|224|8|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
1717
ERROR|COMPILE_TIME_ERROR|BODY_MIGHT_COMPLETE_NORMALLY|lib/_internal/js_dev_runtime/private/foreign_helper.dart|228|6|11|The body might complete normally, which would cause 'null' to be returned, but the return type is a potentially non-nullable type.
18-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1010|10|5|Non-nullable instance field 'value' must be initialized.
19-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1036|8|6|Non-nullable instance field 'secure' must be initialized.
20-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1042|8|8|Non-nullable instance field 'httpOnly' must be initialized.
21-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1499|12|11|Non-nullable instance field 'idleTimeout' must be initialized.
22-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|1549|8|14|Non-nullable instance field 'autoUncompress' must be initialized.
23-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|172|8|12|Non-nullable instance field 'autoCompress' must be initialized.
24-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/_http/http.dart|997|10|4|Non-nullable instance field 'name' must be initialized.
25-
ERROR|COMPILE_TIME_ERROR|NOT_INITIALIZED_NON_NULLABLE_INSTANCE_FIELD|lib/io/io.dart|5589|12|8|Non-nullable instance field 'encoding' must be initialized.

sdk_nnbd/lib/_http/http.dart

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ abstract class HttpServer implements Stream<HttpRequest> {
142142
*
143143
* The default value is `null`.
144144
*/
145-
String? serverHeader;
145+
String? get serverHeader;
146+
void set serverHeader(String? newServerHeader);
146147

147148
/**
148149
* Default set of headers added to all response objects.
@@ -169,7 +170,8 @@ abstract class HttpServer implements Stream<HttpRequest> {
169170
* The default value is `false` (compression disabled).
170171
* To enable, set `autoCompress` to `true`.
171172
*/
172-
bool autoCompress;
173+
bool get autoCompress;
174+
void set autoCompress(bool newAutoCompress);
173175

174176
/**
175177
* Gets or sets the timeout used for idle keep-alive connections. If no
@@ -183,7 +185,8 @@ abstract class HttpServer implements Stream<HttpRequest> {
183185
*
184186
* To disable, set [idleTimeout] to `null`.
185187
*/
186-
Duration? idleTimeout;
188+
Duration? get idleTimeout;
189+
void set idleTimeout(Duration? newIdleTimeout);
187190

188191
/**
189192
* Starts listening for HTTP requests on the specified [address] and
@@ -994,7 +997,8 @@ abstract class Cookie {
994997
* `(`, `)`, `<`, `>`, `@`, `,`, `;`, `:`, `\`, `"`, `/`, `[`, `]`, `?`, `=`,
995998
* `{`, and `}`.
996999
*/
997-
String name;
1000+
String get name;
1001+
void set name(String newName);
9981002

9991003
/**
10001004
* The value of the cookie.
@@ -1007,39 +1011,46 @@ abstract class Cookie {
10071011
* Cookie values may be wrapped in a single pair of double quotes
10081012
* (U+0022, `"`).
10091013
*/
1010-
String value;
1014+
String get value;
1015+
void set value(String newValue);
10111016

10121017
/**
10131018
* The time at which the cookie expires.
10141019
*/
1015-
DateTime? expires;
1020+
DateTime? get expires;
1021+
void set expires(DateTime? newExpires);
10161022

10171023
/**
10181024
* The number of seconds until the cookie expires. A zero or negative value
10191025
* means the cookie has expired.
10201026
*/
1021-
int? maxAge;
1027+
int? get maxAge;
1028+
void set maxAge(int? newMaxAge);
10221029

10231030
/**
10241031
* The domain that the cookie applies to.
10251032
*/
1026-
String? domain;
1033+
String? get domain;
1034+
void set domain(String? newDomain);
10271035

10281036
/**
10291037
* The path within the [domain] that the cookie applies to.
10301038
*/
1031-
String? path;
1039+
String? get path;
1040+
void set path(String? newPath);
10321041

10331042
/**
10341043
* Whether to only send this cookie on secure connections.
10351044
*/
1036-
bool secure;
1045+
bool get secure;
1046+
void set secure(bool newSecure);
10371047

10381048
/**
10391049
* Whether the cookie is only sent in the HTTP request and is not made
10401050
* available to client side scripts.
10411051
*/
1042-
bool httpOnly;
1052+
bool get httpOnly;
1053+
void set httpOnly(bool newHttpOnly);
10431054

10441055
/**
10451056
* Creates a new cookie setting the name and value.
@@ -1496,7 +1507,8 @@ abstract class HttpClient {
14961507
/// connections.
14971508
///
14981509
/// The default value is 15 seconds.
1499-
Duration idleTimeout;
1510+
Duration get idleTimeout;
1511+
void set idleTimeout(Duration newIdleTimeout);
15001512

15011513
/// Gets and sets the connection timeout.
15021514
///
@@ -1506,7 +1518,8 @@ abstract class HttpClient {
15061518
///
15071519
/// When this is `null`, the OS default timeout is used. The default is
15081520
/// `null`.
1509-
Duration? connectionTimeout;
1521+
Duration? get connectionTimeout;
1522+
void set connectionTimeout(Duration? newConnectionTimeout);
15101523

15111524
/**
15121525
* Gets and sets the maximum number of live connections, to a single host.
@@ -1518,7 +1531,8 @@ abstract class HttpClient {
15181531
*
15191532
* Default is `null`.
15201533
*/
1521-
int? maxConnectionsPerHost;
1534+
int? get maxConnectionsPerHost;
1535+
void set maxConnectionsPerHost(int? newMaxConnectionsPerHost);
15221536

15231537
/**
15241538
* Gets and sets whether the body of a response will be automatically
@@ -1546,7 +1560,8 @@ abstract class HttpClient {
15461560
*
15471561
* Default is `true`.
15481562
*/
1549-
bool autoUncompress;
1563+
bool get autoUncompress;
1564+
void set autoUncompress(bool newAutoUncompress);
15501565

15511566
/// Gets and sets the default value of the `User-Agent` header for all requests
15521567
/// generated by this [HttpClient].
@@ -1555,7 +1570,8 @@ abstract class HttpClient {
15551570
///
15561571
/// If the userAgent is set to `null`, no default `User-Agent` header will be
15571572
/// added to each request.
1558-
String? userAgent;
1573+
String? get userAgent;
1574+
void set userAgent(String? newUserAgent);
15591575

15601576
factory HttpClient({SecurityContext? context}) {
15611577
HttpOverrides? overrides = HttpOverrides.current;

sdk_nnbd/lib/io/io_sink.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ abstract class IOSink implements StreamSink<List<int>>, StringSink {
3131
* The [Encoding] used when writing strings. Depending on the
3232
* underlying consumer this property might be mutable.
3333
*/
34-
Encoding encoding;
34+
Encoding get encoding;
35+
void set encoding(Encoding newEncoding);
3536

3637
/**
3738
* Adds byte [data] to the target consumer, ignoring [encoding].

0 commit comments

Comments
 (0)