我们可以在 Flex 库中使用静态初始化器吗?

发布于 2024-11-28 16:11:35 字数 2292 浏览 1 评论 0原文

我们在我的项目中使用 as3Crypto 库。我们已经下载了代码,进行了一些修改并开始使用它。最初,我们将完整的代码作为项目的一部分包含在内。现在我们尝试将其编译为单独的库文件(.swc)。当我们编译代码时,我们没有收到任何错误,但我们收到一个警告:

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

当我们检查代码时,我们将其跟踪到代码文件 AESKey.as,尤其是来自静态初始化器代码堵塞。我不能简单地忽略该警告,因为它是我的应用程序安全的关键部分。

如果有人遇到这个问题,请帮助我解决这个问题。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

謸气贵蔟 2024-12-05 16:11:35

要回答标题中的问题,看起来是的,您可以在 Flex 库项目中使用静态初始值设定项。这是库项目中的一个类:

package test
{
public class StaticInitializerTest
{
    public static var VALUE:String = "fail";

    {
        VALUE = "pass";
    }
}
}

这是一个使用它的 Flex 应用程序:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
                        creationComplete="onCreationComplete()">
    <mx:Script>
        <![CDATA[
            import test.StaticInitializerTest;

            private function onCreationComplete ():void
            {
                trace("Static initializers in a Flex library project: " + StaticInitializerTest.VALUE);
            }
        ]]>
    </mx:Script>
</mx:WindowedApplication>

这会产生以下输出:

Static initializers in a Flex library project: pass

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:

package test
{
public class StaticInitializerTest
{
    public static var VALUE:String = "fail";

    {
        VALUE = "pass";
    }
}
}

And here is a Flex application that uses it:

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
                        creationComplete="onCreationComplete()">
    <mx:Script>
        <![CDATA[
            import test.StaticInitializerTest;

            private function onCreationComplete ():void
            {
                trace("Static initializers in a Flex library project: " + StaticInitializerTest.VALUE);
            }
        ]]>
    </mx:Script>
</mx:WindowedApplication>

This produces the following output:

Static initializers in a Flex library project: pass
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文