actionscript-3flashflex4mxmlc

Hide AS3 deprecation warning on specific line


ActionScript has an attribute that allows marking fields/classes/functions as deprecated:

http://help.adobe.com/en_US/flex/using/WS2db454920e96a9e51e63e3d11c0bf680e1-7ffe.html#WS2db454920e96a9e51e63e3d11c0bf69084-7a6c

I want to deprecate some fields/classes/functions, without showing the deprecation warnings against myself, in my own code.

package com.ClientModels
{
    public class SteamIdPair
    {
        [Deprecated(replacement="SteamStringId")]
        public var SteamId:Number;
        public var SteamStringId:String;
        public var Id:String;

        public function SteamIdPair(data:Object=null)
        {
            if(data == null)
                return;
            SteamId = data.SteamId; // I want to hide the deprecation warning on this line (only)
            SteamStringId = data.SteamStringId;
            Id = data.Id;

        }
    }
}

Basically, I want my users to see that SteamId:Number is deprecated when THEY use it, but not when I use it in my sdk code. Thus, I can't globally disable deprecation warnings via "show-deprecation-warnings = false"

How do I mark something as deprecated without spamming my users with all the subsequent-warnings within in MY code?


Solution

  • I want my users to see that SteamId:Number is deprecated when THEY use it, but not when I use it in my sdk code.

    You are a user of your code just the same as those other developers. If it is deprecated then you shouldn't be using that code either. Nobody should. If usage is necessary, you have to live with that warning. After all getting that warning is the whole point of that tag.

    Personally, I'd shy away from using a library that tells me what I shouldn't be doing while doing exactly that in its own code.