跨模块继承Interface导致项目无法编译


#1

环境:
IDE:idea 2019.3.3
kotlin: 1.3
项目结构:
模块A中包含:ClassA,InterfaceA,AnnotationA;
模块B中包含:ClassB;
关系如下:
ClassB实现InterfaceA ,
InterfaceA中有方法MethodA上使用注解AnnotationA并赋值注解中属性target值为ClassA
问题:
编译错误,编译错误,无法找到ClassA。(IDE上可以正常引用)
经过反复测试,必要条件主要是跨模块并且是在注解中引用
异常信息:(其中CustomerController是ClassB、StandardFilter是ClassA)
Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Backend Internal error: Exception during file facade code generation
File being compiled: file://D:/ProgramData/git/repository/rdgy/common/rdgy-spring-hibernate-starter/rdgy-spring-hibernate-starter-demo/src/main/kotlin/com/rdgy/parent/demo/web/controller/customer/CustomerController.kt
The root cause java.lang.IllegalStateException was thrown at: org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:113)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:247)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:78)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generatePackage(CodegenFactory.kt:88)
at org.jetbrains.kotlin.codegen.DefaultCodegenFactory.generateModule(CodegenFactory.kt:67)
at org.jetbrains.kotlin.codegen.KotlinCodegenFacade.compileCorrectFiles(KotlinCodegenFacade.java:35)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.generate(KotlinToJVMBytecodeCompiler.kt:634)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileModules$cli(KotlinToJVMBytecodeCompiler.kt:194)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:163)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:51)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:85)
at org.jetbrains.kotlin.cli.common.CLICompiler.execImpl(CLICompiler.kt:43)
at org.jetbrains.kotlin.cli.common.CLITool.exec(CLITool.kt:104)
at org.jetbrains.kotlin.daemon.CompileServiceImpl.compile(CompileServiceImpl.kt:1479)
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 sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:361)
at sun.rmi.transport.Transport$1.run(Transport.java:200)
at sun.rmi.transport.Transport$1.run(Transport.java:197)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:196)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:568)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:826)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:683)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:682)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: Error type encountered: [ERROR : Unresolved type: com/rdgy/parent/spring/model/entity/User$StandardFilter (arrayDimensions=0)] (ErrorType).
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper$typeMappingConfiguration$1.processErrorType(KotlinTypeMapper.kt:113)
at org.jetbrains.kotlin.load.kotlin.TypeSignatureMappingKt.mapType(typeSignatureMapping.kt:100)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt:264)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType$default(KotlinTypeMapper.kt:258)
at org.jetbrains.kotlin.codegen.state.KotlinTypeMapper.mapType(KotlinTypeMapper.kt)
at org.jetbrains.kotlin.codegen.AnnotationCodegen$2.visitKClassValue(AnnotationCodegen.java:463)
at org.jetbrains.kotlin.codegen.AnnotationCodegen$2.visitKClassValue(AnnotationCodegen.java:388)
at org.jetbrains.kotlin.resolve.constants.KClassValue.accept(constantValues.kt:198)
at org.jetbrains.kotlin.codegen.AnnotationCodegen.genCompileTimeValue(AnnotationCodegen.java:512)
at org.jetbrains.kotlin.codegen.AnnotationCodegen.genAnnotationArguments(AnnotationCodegen.java:369)
at org.jetbrains.kotlin.codegen.AnnotationCodegen.genAnnotation(AnnotationCodegen.java:360)
at org.jetbrains.kotlin.codegen.AnnotationCodegen.genAnnotations(AnnotationCodegen.java:135)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethodAnnotationsIfRequired(FunctionCodegen.java:307)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:229)
at org.jetbrains.kotlin.codegen.FunctionCodegen.generateMethod(FunctionCodegen.java:177)
at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDelegationToDefaultImpl(ClassBodyCodegen.java:233)
at org.jetbrains.kotlin.codegen.ClassBodyCodegen.generateDelegatesToDefaultImpl(ClassBodyCodegen.java:226)
at org.jetbrains.kotlin.codegen.ImplementationBodyCodegen.generateSyntheticPartsAfterBody(ImplementationBodyCodegen.java:412)
at org.jetbrains.kotlin.codegen.MemberCodegen.generate(MemberCodegen.java:132)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:302)
at org.jetbrains.kotlin.codegen.MemberCodegen.genClassOrObject(MemberCodegen.java:286)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateClassesAndObjectsInFile(PackageCodegenImpl.java:115)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generateFile(PackageCodegenImpl.java:134)
at org.jetbrains.kotlin.codegen.PackageCodegenImpl.generate(PackageCodegenImpl.java:70)
… 28 more


#2

求解决啊,别沉了啊!~


京ICP备16022265号-2 Kotlin China 2017 - 2018