生成项目时出现Intellij IDEA StackOverflow错误

时间:2018-08-09 11:45:41

标签: java intellij-idea

我正在使用Intellij IDEA社区版,它有一个maven项目,总共有6个模块和122个类。 当我尝试从一个子模块中运行主类时,IDEA首先构建项目,这是当我收到StackOverflowError消息时。当然,这只是在我构建项目时发生的。

它看起来像这样:

Information:javac 1.8.0_25 was used to compile java sources Information:09/08/2018 14:44 - Compilation completed with 1 error and 1 warning in 5 s 57 ms Error:java: java.lang.StackOverflowError

IDEA版本为:2018.1.6

我尝试重新安装相同的版本并安装以前的版本2016.x.x(不记得了)。还尝试使用建议的here -Xss4m解决方案,但没有成功。在其他类似的项目(带有模块的Maven)上,我没有这个问题。

有人知道为什么会发生这种情况吗?我该如何调查问题?

可能与lombok有关(我在IDEA中使用的是lombok插件)吗?

更新

我在下面添加构建日志:

```

2018-08-09 15:00:10,503 [ 116169]   INFO - .incremental.IncProjectBuilder - Building project; isRebuild:false; isMake:true parallel compilation:false
2018-08-09 15:00:10,573 [ 116239]   INFO - .incremental.IncProjectBuilder - Cleaned output directories in 6 ms
2018-08-09 15:00:10,731 [ 116397]   INFO - s.incremental.java.JavaBuilder - Compiling 24 java files; module: PROJECT_XXX_MODULE1
2018-08-09 15:00:13,261 [ 118927]   INFO - s.incremental.java.JavaBuilder - java.lang.StackOverflowError
java.lang.RuntimeException: java.lang.StackOverflowError
    at com.sun.tools.javac.main.Main.compile(Main.java:553)
    at com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:129)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:138)
    at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:198)
    at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:453)
    at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:317)
    at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:244)
    at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:202)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1314)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:991)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1063)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:954)
    at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:787)
    at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
    at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
    at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
    at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
    at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
    at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$$Lambda$26/31644974.run(Unknown Source)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
    at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$$Lambda$8/7438855.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)
Caused by: java.lang.StackOverflowError
    at com.sun.tools.javac.code.Types$UnaryVisitor.visit(Types.java:4532)
    at com.sun.tools.javac.code.Types.supertype(Types.java:2295)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1956)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
    at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
    at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
    at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1958)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
    at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
    at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
    at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1965)
    at com.sun.tools.javac.code.Types$13.visitClassType(Types.java:1945)
    at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
    at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
    at com.sun.tools.javac.code.Types.asSuper(Types.java:1942)
    at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:918)
    at com.sun.tools.javac.code.Types$4.visitClassType(Types.java:841)
    at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:778)
    at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:4451)
    at com.sun.tools.javac.code.Types.isSubtype(Types.java:837)
    at com.sun.tools.javac.code.Types.isSubtype(Types.java:801)
    at com.sun.tools.javac.code.Types.isSubtypeUncheckedInternal(Types.java:754)
    at com.sun.tools.javac.code.Types.isSubtypeUnchecked(Types.java:738)
    at com.sun.tools.javac.code.Types.isConvertible(Types.java:296)
    at com.sun.tools.javac.code.Types.isAssignable(Types.java:2154)
    at com.sun.tools.javac.code.Types.isAssignable(Types.java:2115)
    at com.sun.tools.javac.model.JavacTypes.isAssignable(JavacTypes.java:104)
    at org.springframework.boot.configurationprocessor.TypeUtils.isCollectionOrMap(TypeUtils.java:153)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processSimpleTypes(ConfigurationMetadataAnnotationProcessor.java:221)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:201)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
    [............almost 1000 of the same calls looping between them......]
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processTypeElement(ConfigurationMetadataAnnotationProcessor.java:203)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedType(ConfigurationMetadataAnnotationProcessor.java:331)
    at org.springframework.boot.configurationprocessor.ConfigurationMetadataAnnotationProcessor.processNestedTypes(ConfigurationMetadataAnnotationProcessor.java:286)
2018-08-09 15:00:13,287 [ 118953]   INFO - brains.jps.incremental.Builder - Dependency analysis found 0 affected files
2018-08-09 15:00:13,289 [ 118955]   INFO - s.incremental.java.JavaBuilder - javac 1.8.0_25 was used to compile [PROJECT_XXX_MODULE1]
2018-08-09 15:00:13,972 [      0]   INFO - etbrains.jps.cmdline.BuildMain - ==================================================
2018-08-09 15:00:13,973 [      1]   INFO - etbrains.jps.cmdline.BuildMain - Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2018.1.6/lib/jps-launcher.jar;C:/jdk/jdk1.8.0_25-windows-i586/lib/tools.jar;C:/Program Files/JetBrains/IntelliJ IDEA Community Edition 2018.1.6/lib/optimizedFileManager.jar
2018-08-09 15:00:14,351 [    379]   INFO - etbrains.jps.cmdline.BuildMain - Connection to IDE established in 348 ms
2018-08-09 15:00:14,370 [    398]   INFO - penapi.util.io.win32.IdeaWin32 - Native filesystem for Windows is operational
2018-08-09 15:00:14,415 [    443]   INFO - jps.cmdline.JpsModelLoaderImpl - Loading model: project path = C:/PROJECT_XXX, global options path = C:/Users/me/.IdeaIC2018.1/config/options
2018-08-09 15:00:14,828 [    856]   INFO - jps.cmdline.JpsModelLoaderImpl - Model loaded in 413 ms
2018-08-09 15:00:14,829 [    857]   INFO - jps.cmdline.JpsModelLoaderImpl - Project has 6 modules, 176 libraries
2018-08-09 15:00:14,970 [    998]   INFO - ellij.util.io.PagedFileStorage - lower=100; upper=200; buffer=10; max=656
2018-08-09 15:00:15,223 [   1251]   INFO - etbrains.jps.cmdline.BuildMain - Pre-loaded process ready in 1252 ms

```

更新2:根据Wiciaq123的建议,我将Xmx设置为4G,但没有改变其行为。我的虚拟机选项是:

# custom IntelliJ IDEA VM options

-Xms512m
-Xmx4096m
-Xss512m
-XX:ReservedCodeCacheSize=240m
-XX:+UseG1GC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow

0 个答案:

没有答案