We are using as3Crypto library in my project. We have downloaded the code, modified a bit and started using it. Initially we have included the complete code as the part of the project. Now we are trying to compile it as Separate Library file(.swc). When we compile the code, we didn't get any errors, but we got one warning saying
Severity and Description Path Resource Location Creation Time Id
flex2.compiler.as3.SignatureExtension.SignatureGenerationFailed[level='warning', column='23', node='ForStatement', line='214', cause='flex2.compiler.as3.SignatureAssertionRuntimeException: Unreachable Codepath
at flex2.compiler.as3.SignatureEvaluator.ASSERT(SignatureEvaluator.java:369)
at flex2.compiler.as3.SignatureEvaluator.UNREACHABLE_CODEPATH(SignatureEvaluator.java:357)
at flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1560)
at macromedia.asc.parser.ForStatementNode.evaluate(ForStatementNode.java:50)
at flash.swf.tools.as3.EvaluatorAdapter.evaluate(EvaluatorAdapter.java:338)
at flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1795)
at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
at flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:530)
at macromedia.asc.parser.ClassDefinitionNode.evaluate(ClassDefinitionNode.java:106)
at flash.swf.tools.as3.EvaluatorAdapter.evaluate(EvaluatorAdapter.java:338)
at flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:1795)
at macromedia.asc.parser.StatementListNode.evaluate(StatementListNode.java:60)
at flex2.compiler.as3.SignatureEvaluator.evaluate(SignatureEvaluator.java:454)
at macromedia.asc.parser.ProgramNode.evaluate(ProgramNode.java:80)
at flex2.compiler.as3.SignatureExtension.generateSignature(SignatureExtension.java:270)
at flex2.compiler.as3.SignatureExtension.doSignatureGeneration(SignatureExtension.java:174)
at flex2.compiler.as3.SignatureExtension.parse1(SignatureExtension.java:137)
at flex2.compiler.as3.Compiler.parse1(Compiler.java:369)
', path='C:\MyData\Flex WorkSpaces\Separate\HurlantCryptoLib\src\com\hurlant\crypto\symmetric\AESKey.as'] HurlantCryptoLib/src/com/hurlant/crypto/symmetric AESKey.as line 214 1312947481229 27
When we check the code, we traced it to a code file AESKey.as, especially from a Static initializers code block. I can't simply ignore the warning as it is the critical part of my applications security.
If Anybody come across this problem, please help me to fix this issue.
To answer the question in the title, it looks like, yes, you can use static initializers in a Flex library project. Here is a class in a library project:
And here is a Flex application that uses it:
This produces the following output: