天天看点

Exception in thread main java.lang.AssertionError

最近用上了新的jdk11,报了个这么个错误,莫名其妙。

Exception in thread "main" java.lang.AssertionError
        at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:155)
        at jdk.compiler/com.sun.tools.javac.util.Assert.check(Assert.java:46)
        at jdk.compiler/com.sun.tools.javac.comp.Modules.enter(Modules.java:247)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.readSourceFile(JavaCompiler.java:837)
        at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$ImplicitCompleter.complete(JavacProcessingEnvironment.java:1529)
        at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
        at jdk.compiler/com.sun.tools.javac.code.Symbol$ClassSymbol.complete(Symbol.java:1326)
        at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.complete(Type.java:1140)
        at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.getTypeArguments(Type.java:1066)
        at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:237)
        at jdk.compiler/com.sun.tools.javac.code.Printer.visitClassType(Printer.java:52)
        at jdk.compiler/com.sun.tools.javac.code.Type$ClassType.accept(Type.java:993)
        at jdk.compiler/com.sun.tools.javac.code.Printer.visit(Printer.java:136)
        at 。。。
           

原来用了snapshot版本的swagger,更新代码后compile就挂了。

加上forceJavacCompilerUse强制打印出compile的错误信息。

<plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <!-- forceJavacCompilerUse can help to show the location of exact compilation error -->
<forceJavacCompilerUse>true</forceJavacCompilerUse>