Consider the following class:
The compiler should give eight warnings for each of the lines in the constructor. However, it actually gives 10 warnings. Here are the two extra warnings:
Notice that there are no warnings for STATIC_DEPRECATED2 and memberDeprecated2 because they are not initialized. It's only when a member or static variable is initialized that the warnings are shown. It appears that when the compiler checks for usage of deprecated variables is a little too aggressive.
The Falcon compiler and Adobe's ASC 2.0 compiler do not give these same extra warnings. They only give a warning on actual usage.
These warnings make it difficult to deprecate a constant or another variable in an open source library. It makes compile-time noisy with a lot of warnings that need to be ignored.
Note: When compiling with a library in SWC form, the compiler does not show these warnings. I suspect that this is why this was never really encountered with the Flex framework, since the SWCs are pre-compiled. However, for many open source libraries, developers often simply use the source code with the -source-path compiler option instead of a pre-compiled SWC. That's when these warnings can be seen. As a long-time library developer, I never used [Deprecated] metadata because of this bug.
Solution, which I will implement:
In LintEvaluator, modify evaluate( Context cx, SetExpressionNode node ).
The declaration of a member/static variable is a QualifiedIdentifierNode (qualified meaning that it may have modifiers like public/private, static, etc.), but actual usage will be an IdentifierNode instead. So, if it's a QualifiedIdentifierNode, we know that we don't need to check if the variable is deprecated or not.