1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
|
class Main {
static function main() {
// deprecating type objects work
MyClass;
MyInterface;
MyEnum;
// MyAbstract; // this compiles when analyzer=yes, but is another issue
TClass;
TInterface;
TEnum;
// TAbstract; // this compiles when analyzer=yes, but is another issue
// TAnon; // this won't and shouldn't compile anyway
// deprecating types instantiated work
new MyClass();
MyEnum.None;
new MyAbstract(null); // but doesn't work on abstracts...
new TClass();
TEnum.None;
new TAbstract(null); // neither
// some physical access to deprecated API
deprecatedField;
deprecatedFunc();
deprecatedProperty; // this won't show warnings
var x = deprecatedProperty; // this also
deprecatedGetSet; // however this will
var x = deprecatedGetSet; // this also
// the enum @:deprecated trumps the enum field one... should be fine
switch (None) {
case None:
}
switch (None2) {
case None2:
}
}
// deprecating fields work
@:deprecated static var deprecatedField:String;
@:deprecated static function deprecatedFunc() return;
// ... however deprecating getters and setters have some gotcha
@:deprecated static var deprecatedProperty(get, set):String;
static function get_deprecatedProperty():String return "0";
static function set_deprecatedProperty(_):String return "0";
static var deprecatedGetSet(get, set):String;
@:deprecated static function get_deprecatedGetSet():String return "0";
@:deprecated static function set_deprecatedGetSet(_):String return "0";
}
@:deprecated
class MyClass { public function new() {} }
@:deprecated
interface MyInterface { }
@:deprecated
enum MyEnum { @:deprecated None; }
enum MyEnum2 { @:deprecated None2; }
@:deprecated
abstract MyAbstract(String) { public function new(value:String) this = value; }
@:deprecated
typedef TClass = MyClass;
@:deprecated
typedef TInterface = MyInterface;
@:deprecated
typedef TEnum = MyEnum;
@:deprecated
typedef TAbstract = MyAbstract;
@:deprecated
typedef TAnon = { a:String };
|