Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Unified Diff: sdk/lib/core/annotations.dart

Issue 27523002: Add "deprecated" to the standard library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Put annoatations in dart:core. Add documentation. Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_collection_dev/iterable.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/core/annotations.dart
diff --git a/sdk/lib/core/annotations.dart b/sdk/lib/core/annotations.dart
new file mode 100644
index 0000000000000000000000000000000000000000..9a583ccdf83eb6fda03aa55d3c6169f1f05cc6a2
--- /dev/null
+++ b/sdk/lib/core/annotations.dart
@@ -0,0 +1,74 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+part of dart.core;
+
+class _Deprecated {
+ const _Deprecated();
+}
+
+class _Override {
+ const _Override();
+}
+
+/**
+ * The annotation "@deprecated" marks a feature as deprecated.
+ *
+ * The intent of the "@deprecated" annotation is to inform users of a feature
+ * that they should change their code, even if it is currently still working
+ * correctly.
+ *
+ * A deprecated feature is scheduled to be removed at a later time. This means
+ * that a deprecated feature should not be used, or code using it will break
+ * at some point in the future. If there is code using the feature, that
+ * code should be rewritten to not use the deprecated feature.
+ *
+ * A deprecated feature should document how the same effect can be achieved,
+ * so the programmer knows how to rewrite the code.
+ *
+ * The "@deprecated" annotation applies to libraries, top-level declarations
+ * (variables, getters, setters, functions, classes and typedefs),
+ * class-level declarations (variables, getters, setters, methods, operators or
+ * constructors, whether static or not), named optional arguments and
+ * trailing optional positional parameters.
+ *
+ * Deprecation is transitive:
+ * If a library is deprecated, so is every member of it.
+ * If a class is deprecated, so is every member of it.
+ * If a variable is deprecated, so are its implicit getter and setter.
+ *
+ * A tool that processes Dart source code may report when:
+ * - the code imports a deprecated library.
+ * - the code exports a deprecated library, or any deprecated member of
+ *  a non-deprecated library.
+ * - the code refers statically to a deprecated declaration.
+ * - the code dynamically uses a member of an object with a statically known
+ * type, where
+ * - the member is deprecated on the static type of the object, or
+ * - the member use is a method call with an optional parameter where the
+ * parameter is deprecated on the member in the object's static type.
+ *
+ * If the deprecated use is inside a library, class or method which is itself
+ * deprecated, the tool should not bother the user about it.
+ * A deprecated feature is expected to use other deprecated features.
+ */
+const deprecated = const _Deprecated();
+
+/*
+ * The annotation "@override" marks an instance member as overriding a
+ * superclass member with the same name.
+ *
+ * The annotation applies to instance methods, getters and setters, and to
+ * instance fields, where it means that the implicit getter and setter of the
+ * field is marked as overriding, but the field itself is not.
+ *
+ * A tool may report if no declaration of an annotated member is inherited by
+ * the class from either a superclass or an interface.
+ *
+ * The intent of the "override" notation is to catch situations where a
+ * superclass renames a member, and an independent subclass which used to
+ * override the member, could silently continue working using the
+ * superclass implementation.
+ */
+const override = const _Override();
ahe 2013/10/23 14:32:55 This is not OK. You need explicit approval from th
« no previous file with comments | « sdk/lib/_collection_dev/iterable.dart ('k') | sdk/lib/core/core.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698