这是一个javac错误或我的代码中的一些错误

时间:2011-07-05 14:27:15

标签: java javac

当我运行我的Ant脚本时,我收到以下错误

  compile-src:
     [echo] Source include pattern                = **/*.java
     [echo] Source exclude pattern                = 
     [echo] Compiling From Source:                = /u1/cibuild/.hudson/jobs/LDICommon/workspace/src
    [javac] Compiling 99 source files to /u1/cibuild/.hudson/jobs/LDICommon/workspace/dbg1.5/classes/src
    [javac] An exception has occurred in the compiler (1.5.0_09). 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.
    [javac] java.lang.AssertionError: {rawtypes}
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitArray(TreeMaker.java:634)
    [javac]     at com.sun.tools.javac.code.Attribute$Array.accept(Attribute.java:124)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:637)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.visitCompoundInternal(TreeMaker.java:628)
    [javac]     at com.sun.tools.javac.tree.TreeMaker$AnnotationBuilder.translate(TreeMaker.java:641)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.Annotation(TreeMaker.java:649)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.Annotations(TreeMaker.java:570)
    [javac]     at com.sun.tools.javac.tree.TreeMaker.VarDef(TreeMaker.java:554)
    [javac]     at com.sun.tools.javac.comp.Lower.visitIterableForeachLoop(Lower.java:2892)
    [javac]     at com.sun.tools.javac.comp.Lower.visitForeachLoop(Lower.java:2755)
    [javac]     at com.sun.tools.javac.tree.Tree$ForeachLoop.accept(Tree.java:597)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    [javac]     at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    [javac]     at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.visitForLoop(Lower.java:2948)
    [javac]     at com.sun.tools.javac.tree.Tree$ForLoop.accept(Tree.java:581)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.visitIterableForeachLoop(Lower.java:2894)
    [javac]     at com.sun.tools.javac.comp.Lower.visitForeachLoop(Lower.java:2755)
    [javac]     at com.sun.tools.javac.tree.Tree$ForeachLoop.accept(Tree.java:597)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    [javac]     at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.visitIf(Lower.java:2382)
    [javac]     at com.sun.tools.javac.tree.Tree$If.accept(Tree.java:715)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    [javac]     at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.visitIf(Lower.java:2383)
    [javac]     at com.sun.tools.javac.tree.Tree$If.accept(Tree.java:715)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:54)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:145)
    [javac]     at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:2927)
    [javac]     at com.sun.tools.javac.tree.Tree$Block.accept(Tree.java:535)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:129)
    [javac]     at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2267)
    [javac]     at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2186)
    [javac]     at com.sun.tools.javac.tree.Tree$MethodDef.accept(Tree.java:478)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:1989)
    [javac]     at com.sun.tools.javac.tree.Tree$ClassDef.accept(Tree.java:434)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1881)
    [javac]     at com.sun.tools.javac.comp.Lower.translate(Lower.java:1901)
    [javac]     at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3064)
    [javac]     at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:487)
    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:592)
    [javac]     at com.sun.tools.javac.main.Main.compile(Main.java:544)
    [javac]     at com.sun.tools.javac.Main.compile(Main.java:67)
    [javac]     at com.sun.tools.javac.Main.main(Main.java:52)

BUILD FAILED

我不确定发生了什么,我可以在ant(在eclipse)之外编译这个项目而没有问题。

我几乎可以确定编译器中有关错误的消息是一个红色的鲱鱼,我怀疑真正的问题与消息有关:

[javac] java.lang.AssertionError: {rawtypes}

但没有太多信息可以帮助追踪错误的根本原因。

有什么想法吗?

2 个答案:

答案 0 :(得分:2)

鉴于你的编译器很老而且没有公开支持,我认为升级你的JDK将是一个很好的起点。

Java 5.0的最后一个免费版本是更新22(您有更新9)。 http://www.oracle.com/technetwork/java/javase/downloads/index-jdk5-jsp-142662.html

最新版本的Java是Java 6 update 26。 http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html

答案 1 :(得分:2)

它清楚地表明这是一个编译器错误:

  

编译器(1.5.0_09)发生异常。请提交错误   Java Developer Connection(http://java.sun.com/webapps/bugreport)之后   检查Bug Parade是否有重复项。包括您的计划和以下内容   报告中的诊断。谢谢。

正如彼得所说,首先检查在较新的javac版本中是否出现同样的问题,然后提交错误报告。 (您可以尝试首先将代码最小化为SSCEE。)

Eclipse不使用javac,但包含自己的编译器,因此这里没有告诉我们任何内容。