Kotlin VerifyError:未初始化的对象存在于后向分支90上

时间:2017-10-19 19:11:02

标签: intellij-idea kotlin

我使用Kotlin getting started guide首次在IntelliJ IDEA上使用以下配置设置Kotlin:

IntelliJ IDEA 2017.2.5
Build #IC-172.4343.14, built on September 26, 2017
JRE: 1.8.0_152-release-915-b12 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.11.6

我使用以下代码在新的Kotlin项目中创建了一个App.kt文件:

fun main(args: Array<String>) {
    println("hello")
}

在通过IDE运行代码时,出现以下错误:

Error:Internal error: (java.lang.VerifyError) Uninitialized object exists on backward branch 90
Exception Details:
  Location:
    org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; @171: goto
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713
    0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759
    0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb
    0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411
    0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a
    0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01
    0000060: 0099 004d 1910 b900 c201 003a 1119 0e19
    0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0
    0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e
    0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819
    00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e
    00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704
    00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b
    00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a
    00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101
    00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301
    0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2
    0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704
    0000120: 3ab7 043d b0                           
  Stackmap Table:
    full_frame(@90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{})
    same_frame_extended(@174)
    full_frame(@247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{})
    same_frame(@263)
java.lang.VerifyError: Uninitialized object exists on backward branch 90
Exception Details:
  Location:
    org/jetbrains/kotlin/jps/build/KotlinBuilder.createCompileEnvironment(Ljava/util/Map;Lorg/jetbrains/kotlin/incremental/components/LookupTracker;Lorg/jetbrains/jps/incremental/CompileContext;Lorg/jetbrains/kotlin/jps/build/KotlinBuilder$MessageCollectorAdapter;)Lorg/jetbrains/kotlin/compilerRunner/JpsCompilerEnvironment; @171: goto
  Reason:
    Error exists in the bytecode
  Bytecode:
    0000000: bb03 fe59 b703 ff3a 0619 063a 0719 0713
    0000010: 02d7 2cb6 0403 5719 0713 0405 bb04 0759
    0000020: 2b3a 083a 093a 0a3a 0b3a 0c19 083a 0dbb
    0000030: 0409 5919 08b9 040a 0100 b804 10b7 0411
    0000040: c002 893a 0e19 0db9 028c 0100 c000 b03a
    0000050: 0f19 0fb9 00b9 0100 3a10 1910 b900 be01
    0000060: 0099 004d 1910 b900 c201 003a 1119 0e19
    0000070: 11c0 028e 3a12 3a13 1912 b902 9101 00c0
    0000080: 00c4 b804 173a 1419 1319 1419 11c0 028e
    0000090: 3a15 3a16 3a17 1915 b902 9401 003a 1819
    00000a0: 1719 1619 18b9 041b 0300 57a7 ffaf 190e
    00000b0: 0000 3a13 190c 190b 190a 1909 1913 b704
    00000c0: 1eb6 0403 5719 0713 0420 bb04 2259 2c2b
    00000d0: 2db7 0425 b604 0357 1907 b604 283a 052a
    00000e0: b704 2c3a 0619 06c6 0010 1906 b904 3101
    00000f0: 00b6 013c 9a00 1319 04b2 0216 1304 3301
    0000100: 0701 b801 fa01 b0bb 0262 5919 0619 05b2
    0000110: 002e b604 3719 04c0 01c7 bb04 3959 b704
    0000120: 3ab7 043d b0                           
  Stackmap Table:
    full_frame(@90,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Top,Object[#1022],Object[#1022],Object[#649],Uninitialized[#28],Uninitialized[#28],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187]},{})
    same_frame_extended(@174)
    full_frame(@247,{Object[#2],Object[#649],Object[#727],Object[#98],Object[#428],Object[#1102],Object[#1070],Object[#1022],Object[#649],Object[#1031],Object[#1031],Object[#1005],Object[#1022],Object[#649],Object[#649],Object[#176],Object[#187],Top,Top,Object[#649]},{})
    same_frame(@263)
    at org.jetbrains.kotlin.jps.build.KotlinBuilderService.createModuleLevelBuilders(KotlinBuilderService.java:30)
    at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:54)
    at org.jetbrains.jps.incremental.BuilderRegistry.<init>(BuilderRegistry.java:33)
    at org.jetbrains.jps.incremental.BuilderRegistry$Holder.<clinit>(BuilderRegistry.java:36)
    at org.jetbrains.jps.incremental.BuilderRegistry.getInstance(BuilderRegistry.java:43)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:133)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:236)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$$Lambda$3/1147174008.run(Unknown Source)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$$Lambda$1/684874119.run(Unknown Source)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at java.util.concurrent.FutureTask.run(FutureTask.java:266)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

2 个答案:

答案 0 :(得分:12)

这是由于早期JDK 8版本中的一个错误。打开项目的项目结构,并将项目SDK更改为更新版本。

从JDK 1.8.0_11升级到1.80_72解决了我的问题。

答案 1 :(得分:3)

只需在 文件&gt;项目结构&gt; SDK位置&gt;中查看&#34;使用嵌入式JDK&#34; JDK位置