朋友 首先,谢谢你的帮助。 当我使用IntelliJ IDEA编译一个java项目时,它告诉我"编译失败:内部java编译器错误的想法"。更多细节信息喜欢: 信息:Eclipse编译器4.6.2用于编译java源代码 信息:模块" sinoWeb"由于项目配置/依赖项更改而完全重建 信息:2017/3/23 11:44 - 编译完成,1个错误,0个警告,5分32秒949毫秒 错误:java:编译失败:内部java编译器错误 我很困惑。 以下是我的设置。
答案 0 :(得分:16)
答案 1 :(得分:13)
答案 2 :(得分:11)
答案 3 :(得分:10)
答案 4 :(得分:8)
答案 5 :(得分:6)
在 JIdea 2020.1.2及更高版本中,
这可能是项目结构中设置的语言级别与目标字节码版本不兼容。
您必须更改目标字节码版本。
注意: 如何检查语言水平
答案 6 :(得分:2)
答案 7 :(得分:2)
就我而言,这是因为lombok
库具有intellij 2019.2和java11。
根据this IDEA bug,变通办法再次可行后:
Disable all building from intelliJ and dedicate the build to Maven.
答案 8 :(得分:2)
ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
eurl,
HttpMethod.POST,
requestEntity,
new ParameterizedTypeReference<>() { <---- this causes error
}
);
应该是这样的:
ParameterizedTypeReference<Map<String, Integer>> responseType = new ParameterizedTypeReference<>() {};
ResponseEntity<Map<String, Integer>> response = restTemplate.exchange(
url,
HttpMethod.POST,
requestEntity,
responseType
);
答案 9 :(得分:1)
答案 10 :(得分:1)
我在使用旧版 JDK(openjdk 版本“11”2018-09-25)的 Windows 10 社区版 2020.3 上遇到了同样的错误。
将 JDK 更新到 javac 11.0.10 修复了该问题。
这是使用 openjdk 版本“11”2018-09-25 时出现错误的堆栈跟踪:
java: compiler message file broken: key=compiler.misc.msg.bug arguments=11, {1}, {2}, {3}, {4}, {5}, {6}, {7}
java: java.lang.AssertionError
java: at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
java: at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$2$1.setOverloadKind(DeferredAttr.java:172)
java: at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.visitReference(ArgumentAttr.java:283)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:2190)
java: at jdk.compiler/com.sun.tools.javac.comp.ArgumentAttr.attribArg(ArgumentAttr.java:197)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:653)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribArgs(Attr.java:751)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1997)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribTree(Attr.java:655)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3573)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2110)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitApply(Attr.java:2006)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitReturn(Attr.java:1866)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCReturn.accept(JCTree.java:1546)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStat(Attr.java:724)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribStats(Attr.java:743)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:1294)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1020)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:498)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculative(DeferredAttr.java:481)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr.attribSpeculativeLambda(DeferredAttr.java:456)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.canLambdaBodyCompleteNormally(DeferredAttr.java:900)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.visitLambda(DeferredAttr.java:878)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1807)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode$StructuralStuckChecker.complete(DeferredAttr.java:832)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:335)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:779)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrContext.complete(DeferredAttr.java:626)
java: at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:214)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.rawInstantiate(Resolve.java:605)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.selectBest(Resolve.java:1563)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethodInScope(Resolve.java:1733)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1802)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.findMethod(Resolve.java:1776)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$10.doLookup(Resolve.java:2654)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$BasicLookupHelper.lookup(Resolve.java:3293)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.lookupMethod(Resolve.java:3543)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2651)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.resolveQualifiedMethod(Resolve.java:2645)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.selectSym(Attr.java:3721)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3601)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2598)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$4.complete(DeferredAttr.java:374)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredType.check(DeferredAttr.java:321)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$MethodResultInfo.check(Resolve.java:1060)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.checkArg(Resolve.java:887)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$AbstractMethodCheck.argumentsAcceptable(Resolve.java:775)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve$4.argumentsAcceptable(Resolve.java:896)
java: at jdk.compiler/com.sun.tools.javac.comp.Infer.instantiateMethod(Infer.java:181)
java: at jdk.compiler/com.sun.tools.javac.comp.Resolve.checkMethod(Resolve.java:644)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:4120)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkIdInternal(Attr.java:3913)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkMethodIdInternal(Attr.java:3814)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.checkId(Attr.java:3803)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:3696)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitLambda(Attr.java:2595)
java: at jdk.compiler/com.sun.tools.javac.comp.DeferredAttr$DeferredAttrNode.process(DeferredAttr.java:811)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitIdent(Attr.java:3553)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2243)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:702)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1773)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1452)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:1098)
java: at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:866)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4683)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4574)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4523)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4503)
java: at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4448)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1341)
java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:104)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:147)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:100)
java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:94)
java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:231)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:501)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:353)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:277)
java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:231)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1441)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:1100)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1224)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:1066)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:832)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:419)
java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:132)
java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:302)
java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:132)
java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:219)
java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
java: at java.base/java.lang.Thread.run(Thread.java:834)
java: Compilation failed: internal java compiler error
java: Errors occurred while compiling module 'project'
javac 11 was used to compile java sources
Finished, saving caches...
Compilation failed: errors: 1; warnings: 100
答案 11 :(得分:1)
对我有用的是更新Open JDK版本
答案 12 :(得分:1)
在项目设置(Ctrl + Alt + Shift + S)中将语言级别更改为Java 8可以解决我的问题
答案 13 :(得分:0)
就我而言,使用Java 11,我有:
public List<String> foo() {
...
return response.readEntity(new GenericType<List<String>>() {});
并且Intellij建议我应该使用<>
而不是GenericType<List<String>>
,例如:
public List<String> foo() {
...
return response.readEntity(new GenericType<>() {});
我用四个函数做到了这一点,项目因内部编译器错误而停止编译,还原并重新编译。看起来像是带有类型推断的错误。
答案 14 :(得分:0)
答案 15 :(得分:0)
答案 16 :(得分:0)
一个原因可能是 jdk 版本不符合您项目的最小版本。
答案 17 :(得分:0)
注意 JDK-8177068 问题,这会导致像
这样的内部错误java.lang.NullPointerException
at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1233)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1628)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:393)
at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:213)
...
它在 JDK 11.0.12 和 JDK 14 b14 中得到修复,因此升级有所帮助。