Skip to content

Commit eaf4921

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Document deprecation of @Proxy.
Fixes #32251 Bug: http://dartbug.com/32251 Change-Id: I080f95eb99ed5c3dc058ac84fd9194ff72f59b0a Reviewed-on: https://dart-review.googlesource.com/42760 Reviewed-by: Leaf Petersen <[email protected]> Commit-Queue: Lasse R.H. Nielsen <[email protected]>
1 parent dc7b26e commit eaf4921

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

sdk/lib/core/annotations.dart

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,24 @@ class _Proxy {
166166
}
167167

168168
/**
169+
* This annotation is deprecated and will be removed in Dart 2.
170+
*
171+
* Dart 2 has a more restrictive type system than Dart 1, and it requires
172+
* method access to be either through a known interface or by using
173+
* dynamic invocations. The original intent of `@proxy` (to implement a class
174+
* that isn't known statically, as documented at the end of this text),
175+
* is not supported by Dart 2.
176+
* To continue to perform dynamic invocations on an object,
177+
* it should be accessed through a reference of type `dynamic`.
178+
*
169179
* The annotation `@proxy` marks a class as implementing members dynamically
170180
* through `noSuchMethod`.
171181
*
172182
* The annotation applies to any class. It is inherited by subclasses from both
173183
* superclass and interfaces.
174184
*
175185
* If a class is annotated with `@proxy`, or it implements any class that is
176-
* annotated, then the class is considered to implement any member with regard
177-
* to static type analysis.
186+
* annotated, then all member accesses are allowed on an object of that type.
178187
* As such, it is not a static type warning to access any member of the object
179188
* which is not implemented by the class, or to call a method with a different
180189
* number of parameters than it is declared with.

0 commit comments

Comments
 (0)