事情的经过是这样,我建立了一个含有多个子模块的 Maven 工程 a,为其中一个 Spring Boot 子模块引入了 Lombok 来生成字节码,然后我发现,如果把 a 放到一个含有汉字“一”的文件夹,使用 IDEA 运行 Spring Boot 子模块会报一个 Java 编译错误。上述任何条件不满足,这个问题就不会复现,满足则稳定复现。
报错信息
Information:java: 编译器 (10.0.2) 中出现异常错误。如果在 Bug Database ( http://bugs.java.com) 中没有找到该错误, 请通过 Java Bug 报告页 ( http://bugreport.java.com) 建立该 Java 编译器 Bug。请在报告中附上您的程序和以下诊断信息。谢谢。
Information:java: java.lang.IllegalArgumentException: directories not supported
Information:java: at jdk.compiler/com.sun.tools.javac.file.PathFileObject.<init>(PathFileObject.java:353)
Information:java: at lombok.javac.apt.Javac9BaseFileObjectWrapper.<init>(Javac9BaseFileObjectWrapper.java:42)
Information:java: at lombok.javac.apt.LombokFileObjects$Java9Compiler.wrap(LombokFileObjects.java:172)
Information:java: at lombok.javac.apt.LombokFileObjects.createIntercepting(LombokFileObjects.java:161)
Information:java: at lombok.javac.apt.InterceptingJavaFileManager.getJavaFileForOutput(InterceptingJavaFileManager.java:53)
Information:java: at jdk.compiler/com.sun.tools.javac.jvm.ClassWriter.writeClass(ClassWriter.java:1677)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:749)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1627)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1595)
Information:java: at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:965)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.lambda$doCall$0(JavacTaskImpl.java:100)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.handleExceptions(JavacTaskImpl.java:142)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.doCall(JavacTaskImpl.java:96)
Information:java: at jdk.compiler/com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:90)
Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:198)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:453)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:317)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:244)
Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:202)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1314)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:991)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1063)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:954)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:787)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:376)
Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:183)
Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:308)
Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:137)
Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler.lambda$channelRead0$0(BuildMain.java:235)
Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl.lambda$executeOnPooledThread$0(SharedThreadPoolImpl.java:42)
Information:java: at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:514)
Information:java: at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1135)
Information:java: at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
Information:java: at java.base/java.lang.Thread.run(Thread.java:844)
Information:java: Errors occurred while compiling module 'a'
Information:javac 10.0.2 was used to compile java sources
Information:2018/7/24 下午 3:11 - Compilation completed with 1 error and 0 warnings in 10 s 112 ms
Error:java: Compilation failed: internal java compiler error
java 10.0.2 2018-07-17
Java(TM) SE Runtime Environment 18.3 (build 10.0.2+13)
Java HotSpot(TM) 64-Bit Server VM 18.3 (build 10.0.2+13, mixed mode)
IntelliJ IDEA 2018.1.6 (Ultimate Edition)
Build #IU-181.5540.7, built on July 11, 2018
JRE: 1.8.0_152-release-1136-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
```
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.