3

我想在 Maven 中编译我的项目,但我遇到了这个奇怪的异常。谷歌搜索了很多之后,但我没有找到任何东西。我的 jdk 是 sun jdk 7,这是我的 maven 编译器插件配置

        <plugin>

            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <compilerArgument>-Xlint:all</compilerArgument>
                <showWarnings>true</showWarnings>
                <showDeprecation>true</showDeprecation>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>UTF-8</encoding>
                <debug>true</debug>
                <optimize>true</optimize>
            </configuration>
        </plugin>

和例外

[INFO] Compilation failure
Failure executing javac, but could not parse the error:
An exception has occurred in the compiler (1.7.0). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport)  after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report.  Thank you.
java.lang.AssertionError: java.lang.NullPointerException
    at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1005)
    at com.sun.tools.javac.comp.Attr.checkInit(Attr.java:2627)
    at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:2285)
    at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1677)
    at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:431)
    at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418)
    at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:449)
    at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:203)
    at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:181)
    at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:229)
    at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:243)
    at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:181)
    at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:778)
    at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:56)
    at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:746)
    at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:109)
    at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:101)
    at com.sun.tools.javac.comp.Enter.complete(Enter.java:510)
    at com.sun.tools.javac.comp.Enter.main(Enter.java:469)
    at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:929)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:417)
    at com.sun.tools.javac.main.Main.compile(Main.java:331)
    at com.sun.tools.javac.main.Main.compile(Main.java:322)
    at com.sun.tools.javac.Main.compile(Main.java:94)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compileInProcess(JavacCompiler.java:420)
    at org.codehaus.plexus.compiler.javac.JavacCompiler.compile(JavacCompiler.java:141)
    at org.apache.maven.plugin.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:493)
    at org.apache.maven.plugin.CompilerMojo.execute(CompilerMojo.java:114)
    at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
    at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
    at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
    at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
    at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
    at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.lang.NullPointerException
    at com.sun.tools.javac.code.Lint$AugmentVisitor.augment(Lint.java:290)
    at com.sun.tools.javac.code.Lint.augment(Lint.java:82)
    at com.sun.tools.javac.comp.Attr.attribLazyConstantValue(Attr.java:597)
    at com.sun.tools.javac.code.Symbol$VarSymbol$1.call(Symbol.java:971)
    at com.sun.tools.javac.code.Symbol$VarSymbol.getConstValue(Symbol.java:1003)
    ... 51 more
4

1 回答 1

1

您可能偶然发现了编译器中的错误。

“在检查 Bug Parade 是否有重复项后,请在 Java 开发人员连接 ( http://java.sun.com/webapps/bugreport ) 提交错误。在报告中包含您的程序和以下诊断。谢谢。”

不过,您可能希望在此之前将 JDK 更新到最新版本。

于 2013-07-04T15:04:48.290 回答