Skip to content

Commit 7670491

Browse files
committed
[3.0 alpha] Remove deprecated dart:core apis
- Remove `proxy` and `Provisional` annotations. - Remove `Deprecated.expires` getter. Change-Id: I4521b48bb92e5f8420c778686f4efa9c6426cebb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/258004 Commit-Queue: Lasse Nielsen <[email protected]> Reviewed-by: Brian Quinlan <[email protected]> Reviewed-by: Michael Thomsen <[email protected]> Reviewed-by: Nate Bosch <[email protected]>
1 parent 3ed6560 commit 7670491

File tree

22 files changed

+19
-1827
lines changed

22 files changed

+19
-1827
lines changed

CHANGELOG.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,21 @@
77
- **Breaking change** [#49529][]:
88
- Removed the deprecated [`NoSuchMethodError`][] default constructor.
99
Use the [`NoSuchMethodError.withInvocation`][] named constructor instead.
10+
- Removed the deprecated [`proxy`][] and [`Provisional`][] annotations.
11+
The original `proxy` annotation has no effect in Dart 2,
12+
and the `Provisional` type and [`provisional`][] constant
13+
were only used internally during the Dart 2.0 development process.
14+
- Removed the deprecated [`Deprecated.expires`][] getter.
15+
Use [`Deprecated.message`][] instead.
1016

1117
[#49529]: https://github.com/dart-lang/sdk/issues/49529
18+
[`Deprecated.expires`]: https://api.dart.dev/stable/2.18.4/dart-core/Deprecated/expires.html
19+
[`Deprecated.message`]: https://api.dart.dev/stable/2.18.4/dart-core/Deprecated/message.html
1220
[`NoSuchMethodError`]: https://api.dart.dev/stable/2.18.4/dart-core/NoSuchMethodError/NoSuchMethodError.html
1321
[`NoSuchMethodError.withInvocation`]: https://api.dart.dev/stable/2.18.4/dart-core/NoSuchMethodError/NoSuchMethodError.withInvocation.html
22+
[`Provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/Provisional-class.html
23+
[`provisional`]: https://api.dart.dev/stable/2.18.4/dart-core/provisional-constant.html
24+
[`proxy`]: https://api.dart.dev/stable/2.18.4/dart-core/proxy-constant.html
1425

1526
#### `dart:html`
1627

@@ -130,7 +141,6 @@
130141
constructor.
131142
- Deprecated `NullThrownError` and `CyclicInitializationError`.
132143
Neither error is thrown by null safe code.
133-
134144
[#49529]: https://github.com/dart-lang/sdk/issues/49529
135145
[#24644]: https://github.com/dart-lang/sdk/issues/24644
136146

@@ -342,7 +352,7 @@ Updated the Linter to `1.31.0`, which includes changes that
342352
- Update `dart pub publish` to require a working resolution.
343353
If publishing a breaking release of mutually dependent packages use `dependency_overrides`
344354
to obtain a resolution.
345-
- `dart pub add` will now allow adding multiple packages from any source using
355+
- `dart pub add` will now allow adding multiple packages from any source using
346356
the same YAML syntax as in `pubspec.yaml`.
347357

348358
For example:

pkg/analyzer/lib/src/dart/element/element.dart

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,10 +1943,6 @@ class ElementAnnotationImpl implements ElementAnnotation {
19431943
/// protected.
19441944
static const String _protectedVariableName = 'protected';
19451945

1946-
/// The name of the top-level variable used to mark a class as implementing a
1947-
/// proxy object.
1948-
static const String _proxyVariableName = 'proxy';
1949-
19501946
/// The name of the class used to mark a parameter as being required.
19511947
static const String _requiredClassName = 'Required';
19521948

@@ -2081,7 +2077,7 @@ class ElementAnnotationImpl implements ElementAnnotation {
20812077
bool get isProtected => _isPackageMetaGetter(_protectedVariableName);
20822078

20832079
@override
2084-
bool get isProxy => _isDartCoreGetter(_proxyVariableName);
2080+
bool get isProxy => false;
20852081

20862082
@override
20872083
bool get isRequired =>

pkg/analyzer/lib/src/test_utilities/mock_sdk.dart

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,6 @@ const deprecated = const Deprecated("next release");
274274
275275
const override = const _Override();
276276
277-
const proxy = const _Proxy();
278-
279277
external bool identical(Object? a, Object? b);
280278
281279
void print(Object? object) {}
@@ -318,8 +316,8 @@ class DateTime extends Object {
318316
}
319317
320318
class Deprecated extends Object {
321-
final String expires;
322-
const Deprecated(this.expires);
319+
final String message;
320+
const Deprecated(this.message);
323321
}
324322
325323
class pragma {
@@ -669,10 +667,6 @@ class _Override {
669667
const _Override();
670668
}
671669
672-
class _Proxy {
673-
const _Proxy();
674-
}
675-
676670
@Since("2.15")
677671
extension EnumName on Enum {
678672
String get name => _name;

pkg/analyzer/lib/src/test_utilities/mock_sdk_elements.dart

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ class _MockSdkElementsBuilder {
5252
ClassElementImpl? _numElement;
5353
ClassElementImpl? _objectElement;
5454
ClassElementImpl? _overrideElement;
55-
ClassElementImpl? _proxyElement;
5655
ClassElementImpl? _recordElement;
5756
ClassElementImpl? _setElement;
5857
ClassElementImpl? _stackTraceElement;
@@ -628,20 +627,6 @@ class _MockSdkElementsBuilder {
628627
return overrideElement;
629628
}
630629

631-
ClassElementImpl get proxyElement {
632-
var proxyElement = _proxyElement;
633-
if (proxyElement != null) return proxyElement;
634-
635-
_proxyElement = proxyElement = _class(name: '_Proxy');
636-
proxyElement.supertype = objectType;
637-
638-
proxyElement.constructors = [
639-
_constructor(isConst: true),
640-
];
641-
642-
return proxyElement;
643-
}
644-
645630
ClassElementImpl get recordElement {
646631
var recordElement = _recordElement;
647632
if (recordElement != null) return recordElement;
@@ -930,7 +915,6 @@ class _MockSdkElementsBuilder {
930915
numElement,
931916
objectElement,
932917
overrideElement,
933-
proxyElement,
934918
recordElement,
935919
setElement,
936920
stackTraceElement,
@@ -959,20 +943,13 @@ class _MockSdkElementsBuilder {
959943
_interfaceType(overrideElement),
960944
);
961945

962-
var proxyVariable = _topLevelVariableConst(
963-
'proxy',
964-
_interfaceType(proxyElement),
965-
);
966-
967946
coreUnit.accessors = <PropertyAccessorElementImpl>[
968947
deprecatedVariable.getter!,
969948
overrideVariable.getter!,
970-
proxyVariable.getter!,
971949
];
972950
coreUnit.topLevelVariables = <TopLevelVariableElementImpl>[
973951
deprecatedVariable,
974952
overrideVariable,
975-
proxyVariable,
976953
];
977954

978955
var coreLibrary = LibraryElementImpl(

pkg/analyzer/test/generated/non_hint_code_test.dart

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -78,70 +78,6 @@ class Z {
7878
''');
7979
}
8080

81-
test_proxy_annotation_prefixed() async {
82-
await assertErrorsInCode(r'''
83-
library L;
84-
@proxy
85-
class A {}
86-
f(var a) {
87-
a = new A();
88-
a.m();
89-
var x = a.g;
90-
a.s = 1;
91-
var y = a + a;
92-
a++;
93-
++a;
94-
}
95-
''', [
96-
error(HintCode.UNUSED_LOCAL_VARIABLE, 70, 1),
97-
error(HintCode.UNUSED_LOCAL_VARIABLE, 96, 1),
98-
]);
99-
}
100-
101-
test_proxy_annotation_prefixed2() async {
102-
await assertErrorsInCode(r'''
103-
library L;
104-
@proxy
105-
class A {}
106-
class B {
107-
f(var a) {
108-
a = new A();
109-
a.m();
110-
var x = a.g;
111-
a.s = 1;
112-
var y = a + a;
113-
a++;
114-
++a;
115-
}
116-
}
117-
''', [
118-
error(HintCode.UNUSED_LOCAL_VARIABLE, 88, 1),
119-
error(HintCode.UNUSED_LOCAL_VARIABLE, 118, 1),
120-
]);
121-
}
122-
123-
test_proxy_annotation_prefixed3() async {
124-
await assertErrorsInCode(r'''
125-
library L;
126-
class B {
127-
f(var a) {
128-
a = new A();
129-
a.m();
130-
var x = a.g;
131-
a.s = 1;
132-
var y = a + a;
133-
a++;
134-
++a;
135-
}
136-
}
137-
@proxy
138-
class A {}
139-
''', [
140-
error(HintCode.UNUSED_LOCAL_VARIABLE, 70, 1),
141-
error(HintCode.UNUSED_LOCAL_VARIABLE, 100, 1),
142-
]);
143-
}
144-
14581
test_undefinedMethod_assignmentExpression_inSubtype() async {
14682
await assertNoErrorsInCode(r'''
14783
class A {}

pkg/analyzer/test/src/diagnostics/undefined_getter_test.dart

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
1+
// Copyright (c) 2019, the Dart propject authors. Please see the AUTHORS file
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

@@ -463,22 +463,6 @@ void f(A a) {
463463
''');
464464
}
465465

466-
test_proxy_annotation_fakeProxy() async {
467-
await assertErrorsInCode(r'''
468-
library L;
469-
class Fake {
470-
const Fake();
471-
}
472-
const proxy = const Fake();
473-
@proxy class PrefixProxy {}
474-
main() {
475-
new PrefixProxy().foo;
476-
}
477-
''', [
478-
error(CompileTimeErrorCode.UNDEFINED_GETTER, 127, 3),
479-
]);
480-
}
481-
482466
test_static_conditionalAccess_defined() async {
483467
await assertErrorsInCode(
484468
'''

pkg/analyzer/test/src/task/strong/checker_test.dart

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2825,53 +2825,6 @@ class Child extends helper.Base {
28252825
]);
28262826
}
28272827

2828-
test_proxy() {
2829-
return assertErrorsInCode(r'''
2830-
@proxy class C {}
2831-
@proxy class D {
2832-
var f;
2833-
m() => null;
2834-
operator -() => null;
2835-
operator +(int other) => null;
2836-
operator [](int index) => null;
2837-
call() => null;
2838-
}
2839-
2840-
@proxy class F implements Function { noSuchMethod(i) => 42; }
2841-
2842-
m() {
2843-
D d = new D();
2844-
d.m();
2845-
d.m;
2846-
d.f;
2847-
-d;
2848-
d + 7;
2849-
d[7];
2850-
d();
2851-
2852-
C c = new C();
2853-
c.m();
2854-
c.m;
2855-
-c;
2856-
c + 7;
2857-
c[7];
2858-
c();
2859-
2860-
F f = new F();
2861-
f();
2862-
}
2863-
''', [
2864-
error(HintCode.DEPRECATED_IMPLEMENTS_FUNCTION, 197, 8),
2865-
error(CompileTimeErrorCode.UNDEFINED_METHOD, 332, 1),
2866-
error(CompileTimeErrorCode.UNDEFINED_GETTER, 341, 1),
2867-
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 346, 1),
2868-
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 354, 1),
2869-
error(CompileTimeErrorCode.UNDEFINED_OPERATOR, 362, 3),
2870-
error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 369, 1),
2871-
error(CompileTimeErrorCode.INVOCATION_OF_NON_FUNCTION_EXPRESSION, 394, 1),
2872-
]);
2873-
}
2874-
28752828
test_redirectingConstructor() async {
28762829
await assertErrorsInCode('''
28772830
class A {

pkg/analyzer_cli/test/data/sky_engine/lib/core.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ class DateTime extends Object {}
6565
class Null extends Object {}
6666

6767
class Deprecated extends Object {
68-
final String expires;
69-
const Deprecated(this.expires);
68+
final String message;
69+
const Deprecated(this.message);
7070
}
7171

7272
const Object deprecated = const Deprecated("next release");

pkg/front_end/testcases/general/error_export_from_dill/main.dart.weak.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ import self as self2;
9393
import "dart:core" as core;
9494
import "dart:async" as asy;
9595
additionalExports = (core::Deprecated,
96-
core::Provisional,
9796
core::pragma,
9897
core::BigInt,
9998
core::bool,
@@ -164,8 +163,6 @@ additionalExports = (core::Deprecated,
164163
core::Comparator,
165164
core::deprecated,
166165
core::override,
167-
core::provisional,
168-
core::proxy,
169166
asy::Future,
170167
asy::Stream,
171168
asy::FutureExtensions)

pkg/front_end/testcases/general/error_export_from_dill/main.dart.weak.outline.expect

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import self as self2;
2828
import "dart:core" as core;
2929
import "dart:async" as asy;
3030
additionalExports = (core::Deprecated,
31-
core::Provisional,
3231
core::pragma,
3332
core::BigInt,
3433
core::bool,
@@ -99,8 +98,6 @@ additionalExports = (core::Deprecated,
9998
core::Comparator,
10099
core::deprecated,
101100
core::override,
102-
core::provisional,
103-
core::proxy,
104101
asy::Future,
105102
asy::Stream,
106103
asy::FutureExtensions)

0 commit comments

Comments
 (0)