OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.core; | 5 part of dart.core; |
6 | 6 |
7 /** | 7 /** |
8 * The annotation "@Deprecated('expires when')" marks a feature as deprecated. | 8 * The annotation `@Deprecated('expires when')` marks a feature as deprecated. |
9 * | 9 * |
10 * The annotation "@deprecated" is a shorthand for deprecating until | 10 * The annotation `@deprecated` is a shorthand for deprecating until |
11 * to an unspecified "next release". | 11 * to an unspecified "next release". |
12 * | 12 * |
13 * The intent of the "@Deprecated" annotation is to inform users of a feature | 13 * The intent of the `@Deprecated` annotation is to inform users of a feature |
14 * that they should change their code, even if it is currently still working | 14 * that they should change their code, even if it is currently still working |
15 * correctly. | 15 * correctly. |
16 * | 16 * |
17 * A deprecated feature is scheduled to be removed at a later time, possibly | 17 * A deprecated feature is scheduled to be removed at a later time, possibly |
18 * specified as the "expires" field of the annotation. | 18 * specified as the "expires" field of the annotation. |
19 * This means that a deprecated feature should not be used, or code using it | 19 * This means that a deprecated feature should not be used, or code using it |
20 * will break at some point in the future. If there is code using the feature, | 20 * will break at some point in the future. If there is code using the feature, |
21 * that code should be rewritten to not use the deprecated feature. | 21 * that code should be rewritten to not use the deprecated feature. |
22 * | 22 * |
23 * A deprecated feature should document how the same effect can be achieved, | 23 * A deprecated feature should document how the same effect can be achieved, |
24 * so the programmer knows how to rewrite the code. | 24 * so the programmer knows how to rewrite the code. |
25 * | 25 * |
26 * The "@Deprecated" annotation applies to libraries, top-level declarations | 26 * The `@Deprecated` annotation applies to libraries, top-level declarations |
27 * (variables, getters, setters, functions, classes and typedefs), | 27 * (variables, getters, setters, functions, classes and typedefs), |
28 * class-level declarations (variables, getters, setters, methods, operators or | 28 * class-level declarations (variables, getters, setters, methods, operators or |
29 * constructors, whether static or not), named optional arguments and | 29 * constructors, whether static or not), named optional arguments and |
30 * trailing optional positional parameters. | 30 * trailing optional positional parameters. |
31 * | 31 * |
32 * Deprecation is transitive: | 32 * Deprecation is transitive: |
33 * | 33 * |
34 * - If a library is deprecated, so is every member of it. | 34 * - If a library is deprecated, so is every member of it. |
35 * - If a class is deprecated, so is every member of it. | 35 * - If a class is deprecated, so is every member of it. |
36 * - If a variable is deprecated, so are its implicit getter and setter. | 36 * - If a variable is deprecated, so are its implicit getter and setter. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 class _Override { | 75 class _Override { |
76 const _Override(); | 76 const _Override(); |
77 } | 77 } |
78 | 78 |
79 /** | 79 /** |
80 * Marks a feature as [Deprecated] until the next release. | 80 * Marks a feature as [Deprecated] until the next release. |
81 */ | 81 */ |
82 const deprecated = const Deprecated("next release"); | 82 const deprecated = const Deprecated("next release"); |
83 | 83 |
84 /* | 84 /* |
85 * The annotation "@override" marks an instance member as overriding a | 85 * The annotation `@override` marks an instance member as overriding a |
86 * superclass member with the same name. | 86 * superclass member with the same name. |
87 * | 87 * |
88 * The annotation applies to instance methods, getters and setters, and to | 88 * The annotation applies to instance methods, getters and setters, and to |
89 * instance fields, where it means that the implicit getter and setter of the | 89 * instance fields, where it means that the implicit getter and setter of the |
90 * field is marked as overriding, but the field itself is not. | 90 * field is marked as overriding, but the field itself is not. |
91 * | 91 * |
92 * The intent of the "@override" notation is to catch situations where a | 92 * The intent of the `@override` notation is to catch situations where a |
93 * superclass renames a member, and an independent subclass which used to | 93 * superclass renames a member, and an independent subclass which used to |
94 * override the member, could silently continue working using the | 94 * override the member, could silently continue working using the |
95 * superclass implementation. | 95 * superclass implementation. |
96 * | 96 * |
97 * The editor, or a similar tool aimed at the programmer, may report if no | 97 * The editor, or a similar tool aimed at the programmer, may report if no |
98 * declaration of an annotated member is inherited by the class from either a | 98 * declaration of an annotated member is inherited by the class from either a |
99 * superclass or an interface. | 99 * superclass or an interface. |
100 * | 100 * |
101 * Use the "@override" annotation judiciously and only for methods where | 101 * Use the `@override` annotation judiciously and only for methods where |
102 * the superclass is not under the programmer's control, the superclass is in a | 102 * the superclass is not under the programmer's control, the superclass is in a |
103 * different library or package, and it is not considered stable. | 103 * different library or package, and it is not considered stable. |
104 * In any case, the use of "@override" is optional. | 104 * In any case, the use of `@override` is optional. |
105 * | 105 * |
106 * For example, the annotation is intentionally not used in the Dart platform | 106 * For example, the annotation is intentionally not used in the Dart platform |
107 * libraries, since they only depend on themselves. | 107 * libraries, since they only depend on themselves. |
108 */ | 108 */ |
109 const override = const _Override(); | 109 const override = const _Override(); |
| 110 |
| 111 class _Proxy { |
| 112 const _Proxy(); |
| 113 } |
| 114 |
| 115 /** |
| 116 * The annotation `@proxy` marks a class as implementing members through |
| 117 * `noSuchMethod`. |
| 118 * |
| 119 * The annotation applies to concrete classes. It is not inherited by |
| 120 * subclasses. |
| 121 * |
| 122 * The marked class is considerer to implement any method, getter or setter |
| 123 * declared by its interface, even if there is no implementation in the |
| 124 * class. It will not generate the warning that is otherwise specified for an |
| 125 * unimplemented method in a non-abstract class. |
| 126 * |
| 127 * Tools that understand `@proxy` should tell the user if a class using `@proxy` |
| 128 * does not override the `noSuchMethod` declared on [Object]. |
| 129 * |
| 130 * The intent of the `@proxy` notation is to avoid irrelevant warnings when |
| 131 * a class implements its interface through `noSuchMethod`. |
| 132 */ |
| 133 const proxy = const _Proxy(); |
OLD | NEW |