【BUG?】kotlinc throw NullPointerException

// null.kt
fun main(args: Array) {
fun foo(): Unit {}
assert(Unit.javaClass.equals(foo().javaClass)) // OK
assert(Unit.javaClass.equals(foo()::class.java)) // NullPointerException
}

kotlinc null.kt

null.kt:1:1: exception: org.jetbrains.kotlin.codegen.CompilationException: Back-end (JVM) Internal error: Failed to generate function main
Cause: java.lang.NullPointerException
File being compiled and position: (1,1) in /home/aoeiuv/tmp/kotlin/cmd/null.kt
PsiElement: fun main(args: Array) {
fun foo(): Unit {}
var u = foo()
assert(Unit.javaClass.equals(foo().javaClass))
assert(Unit.javaClass.equals(foo()::class.java))
}
The root cause was thrown at: String.java:204
at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:203)
at org.jetbrains.kotlin.codegen.PackagePartCodegen.generateBody(PackagePartCodegen.java:98)
at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:128)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:133)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:66)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.generatePackage(KotlinCodegenFacade.java:99)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.doGenerateFiles(KotlinCodegenFacade.java:77)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:44)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:417)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.analyzeAndGenerate(KotlinToJVMBytecodeCompiler.kt:328)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileBunchOfSources(KotlinToJVMBytecodeCompiler.kt:208)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:198)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:54)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:178)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:125)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:52)
at org.jetbrains.kotlin.cli.common.CLICompiler.doMainNoExit(CLICompiler.java:379)
at org.jetbrains.kotlin.cli.common.CLICompiler.doMain(CLICompiler.java:369)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:283)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jetbrains.kotlin.preloading.Preloader.run(Preloader.java:73)
at org.jetbrains.kotlin.preloading.Preloader.main(Preloader.java:35)
Caused by: java.lang.NullPointerException
at java.lang.String.(String.java:204)
at org.jetbrains.org.objectweb.asm.Type.getInternalName(Type.java:589)
at org.jetbrains.kotlin.codegen.intrinsics.JavaClassProperty.generateImpl(JavaClassProperty.kt:50)
at org.jetbrains.kotlin.codegen.ExpressionCodegen$16.invoke(ExpressionCodegen.java:3432)
at org.jetbrains.kotlin.codegen.ExpressionCodegen$16.invoke(ExpressionCodegen.java:3427)
at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:65)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:109)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:102)
at org.jetbrains.kotlin.codegen.CallGenerator$DefaultCallGenerator.genValueAndPut(CallGenerator.kt:62)
at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generateExpression(CallBasedArgumentGenerator.java:77)
at org.jetbrains.kotlin.codegen.ArgumentGenerator.generate(ArgumentGenerator.kt:66)
at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generate(CallBasedArgumentGenerator.java:64)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2874)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2854)
at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:44)
at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:23)
at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:65)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:109)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:102)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.putValueIfNeeded(InlineCodegen.java:949)
at org.jetbrains.kotlin.codegen.inline.InlineCodegen.genValueAndPut(InlineCodegen.java:924)
at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generateExpression(CallBasedArgumentGenerator.java:77)
at org.jetbrains.kotlin.codegen.ArgumentGenerator.generate(ArgumentGenerator.kt:66)
at org.jetbrains.kotlin.codegen.CallBasedArgumentGenerator.generate(CallBasedArgumentGenerator.java:64)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2874)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.invokeMethodWithArguments(ExpressionCodegen.java:2854)
at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:44)
at org.jetbrains.kotlin.codegen.Callable$invokeMethodWithArguments$1.invoke(Callable.kt:23)
at org.jetbrains.kotlin.codegen.OperationStackValue.putSelector(StackValue.kt:65)
at org.jetbrains.kotlin.codegen.StackValueWithLeaveTask.putSelector(StackValue.kt:57)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:109)
at org.jetbrains.kotlin.codegen.StackValue.put(StackValue.java:102)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.putStackValue(ExpressionCodegen.java:350)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.gen(ExpressionCodegen.java:335)
at org.jetbrains.kotlin.codegen.ExpressionCodegen.returnExpression(ExpressionCodegen.java:2256)
at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$FunctionDefault.doGenerateBody(FunctionGenerationStrategy.java:49)
at org.jetbrains.kotlin.codegen.FunctionGenerationStrategy$CodegenBased.generateBody(FunctionGenerationStrategy.java:69)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodBody(FunctionCodegen.java:494)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:254)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:175)
at org.jetbrains.kotlin.codegen.FunctionCodegen.gen(FunctionCodegen.java:146)
at org.jetbrains.kotlin.codegen.MemberCodegen.genSimpleMember(MemberCodegen.java:194)
… 25 more

fun main(args: Array) {
^

Yes that looks like a bug, could you report it to http://kotl.in/issue?

ok, I have reported it,