OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 part of dart.core; | |
6 | |
7 /** | |
8 * The annotation "@Deprecated('expires when')" marks a feature as deprecated. | |
9 * | |
10 * The annotation "@deprecated" is a shorthand for deprecating until | |
11 * to an unspecified "next release". | |
12 * | |
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 | |
15 * correctly. | |
16 * | |
17 * A deprecated feature is scheduled to be removed at a later time, possibly | |
18 * specified as the "expires" field of the annotation. | |
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, | |
21 * that code should be rewritten to not use the deprecated feature. | |
22 * | |
23 * A deprecated feature should document how the same effect can be achieved, | |
24 * so the programmer knows how to rewrite the code. | |
25 * | |
26 * The "@Deprecated" annotation applies to libraries, top-level declarations | |
27 * (variables, getters, setters, functions, classes and typedefs), | |
28 * class-level declarations (variables, getters, setters, methods, operators or | |
29 * constructors, whether static or not), named optional arguments and | |
30 * trailing optional positional parameters. | |
31 * | |
32 * Deprecation is transitive: | |
33 * | |
34 * - If a library 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. | |
37 * | |
38 * | |
39 * A tool that processes Dart source code may report when: | |
40 * | |
41 * - the code imports a deprecated library. | |
42 * - the code exports a deprecated library, or any deprecated member of | |
43 * a non-deprecated library. | |
44 * - the code refers statically to a deprecated declaration. | |
45 * - the code dynamically uses a member of an object with a statically known | |
46 * type, where the member is deprecated on the static type of the object. | |
47 * - the code dynamically calls a method with an argument where the | |
48 * corresponding optional parameter is deprecated on the object's static type. | |
49 * | |
50 * | |
51 * If the deprecated use is inside a library, class or method which is itself | |
52 * deprecated, the tool should not bother the user about it. | |
53 * A deprecated feature is expected to use other deprecated features. | |
54 */ | |
55 class Deprecated { | |
56 /** | |
57 * A description of when the deprecated feature is expected to be retired. | |
58 */ | |
59 final String expires; | |
60 | |
61 /** | |
62 * Create a deprecation annotation which specifies the expiration of the | |
63 * annotated feature. | |
64 * | |
65 * The [expires] argument should be readable by programmers, and should state | |
66 * when an annotated feature is expected to be removed. | |
67 * This can be specified, for example, as a date, as a release number, or | |
68 * as relative to some other change (like "when bug 4418 is fixed"). | |
69 */ | |
70 const Deprecated(String expires) : this.expires = expires; | |
71 | |
72 String toString() => "Deprecated until $expires"; | |
bakster
2013/10/24 10:55:25
"Deprecated feature. Will be removed $expires"
| |
73 } | |
74 | |
75 class _Override { | |
76 const _Override(); | |
77 } | |
78 | |
79 /** | |
80 * Marks a feature as [Deprecated] until the next release. | |
81 */ | |
82 const deprecated = const Deprecated("next release"); | |
83 | |
84 /* | |
85 * The annotation "@override" marks an instance member as overriding a | |
86 * superclass member with the same name. | |
87 * | |
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 | |
90 * field is marked as overriding, but the field itself is not. | |
91 * | |
92 * A tool may report if no declaration of an annotated member is inherited by | |
93 * the class from either a superclass or an interface. | |
94 * | |
95 * The intent of the "override" notation is to catch situations where a | |
96 * superclass renames a member, and an independent subclass which used to | |
97 * override the member, could silently continue working using the | |
98 * superclass implementation. | |
99 */ | |
100 const override = const _Override(); | |
OLD | NEW |