gpt4 book ai didi

Java 8 : Expecting a stackmap frame at branch target 65

转载 作者:行者123 更新时间:2023-11-30 10:58:38 32 4
gpt4 key购买 nike

使用jdk 1.8.0_51源=1.7,目标=1.7Junit 4.6, Ant 1.8.0

发生了什么事?
所有通过 1.7 的测试现在都失败了。我需要了解以下内容:

  1. 为什么会这样?
  2. 有没有像-XX:-UseSplitVerifier(java 1.7)这样的选项
  3. 如何找出问题的根本原因?
  4. 要采取什么步骤来解决这个问题?

我们有用于构建、部署和测试的 ant 目标。
构建和部署工作没有问题,但 Junit 测试在所有模块中都失败了。
我尝试升级 ant(1.8.9)、junit 4.10。
这可能是因为任何不是用java 1.8编译的jar吗?
我应该确保我使用的所有 jar 都是用 java8 编译的吗?如果是的话,那可能是个坏兆头:(

我尝试通过命令提示符运行 junit,它成功了。

java -cp ./target/package-test:./target/mycompany-common.jar:./lib/junit-4.6.jar org.junit.runner.JUnitCore com.mycompany.JunitTest

=====================================================================================           Tests:    1        Batches:    1        Threads:    1           Host: remote=====================================================================================TEST                                                    RUN FAIL ERR SKIP    DURATIONJunitTest                                                1    1              0.068 sec-------------------------------------------------------------------------------------TOTAL                                                    1    1     =====================================================================================The following tests had failures or errors:com.mycompany.JunitTestThe failures and errors can be seen in the following files:/target/reports/junit/TEST-com.mycompany.JunitTest.txtResults of first failed test:Testsuite: com.mycompany.JunitTestTests run: 1, Failures: 0, Errors: 1, Time elapsed: 0.068 secTestcase: test took 0.018 sec    Caused an ERRORExpecting a stackmap frame at branch target 65Exception Details:  Location:    com/mycompany/Identifier.equals(Ljava/lang/Object;)Z @26: ifne  Reason:    Expected stackmap frame at this location.  Bytecode:    0x0000000: 033d 11ff ff3e 1215 1100 35b8 001b 2bc1    0x0000010: 0002 1100 353d 1100 003e 9a00 271c 1100    0x0000020: 35a0 0016 1d11 0000 a000 0f12 151c 1d04    0x0000030: b800 4111 ffff 3e12 1511 0036 b800 1b03    0x0000040: ac1d 9b00 0f12 151c 1d03 b800 4111 ffff    0x0000050: 3e12 1511 0039 b800 1b2b c000 023a 0412    0x0000060: 1511 003a b800 1b2a b400 2619 04b4 0026    0x0000070: b600 43ac                                Stackmap Table:    same_frame_extended(@89)java.lang.VerifyError: Expecting a stackmap frame at branch target 65Exception Details:  Location:    com/mycompany/Identifier.equals(Ljava/lang/Object;)Z @26: ifne  Reason:    Expected stackmap frame at this location.  Bytecode:    0x0000000: 033d 11ff ff3e 1215 1100 35b8 001b 2bc1    0x0000010: 0002 1100 353d 1100 003e 9a00 271c 1100    0x0000020: 35a0 0016 1d11 0000 a000 0f12 151c 1d04    0x0000030: b800 4111 ffff 3e12 1511 0036 b800 1b03    0x0000040: ac1d 9b00 0f12 151c 1d03 b800 4111 ffff    0x0000050: 3e12 1511 0039 b800 1b2b c000 023a 0412    0x0000060: 1511 003a b800 1b2a b400 2619 04b4 0026    0x0000070: b600 43ac                                Stackmap Table:    same_frame_extended(@89)    at com.mycompany.JunitTest.test(JunitTest.java:17)

最佳答案

从 Java 8 开始,--usesplitverifier 没有等效项。

  1. 您可以使用“-noverify”来阻止 java 8 在严格字节码实现模式下编译代码。

  2. 如果使用 Eclipse,您还可以执行 windows->preferences->compiler -> 取消选中“保留未使用的局部变量”选项

关于Java 8 : Expecting a stackmap frame at branch target 65,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32169727/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com