简体   繁体   English

使用ant和Java 1.7编译问题

[英]Compile problems using ant and Java 1.7

I am trying to compile a code base using ant and the javac 1.7 compiler. 我正在尝试使用ant和javac 1.7编译器编译代码库。 Currently, the code base compiles using the 1.6 compiler but when I switch to the 1.7 compiler, I get the following two oddities. 目前,代码库使用1.6编译器进行编译,但是当我切换到1.7编译器时,我得到以下两个奇怪的东西。

1) I get a warning: "warning: x is internal proprietary API and may be removed in a future release" where x is part of an internal proprietary API yet the line in the code it references does not reference x (nor does it reference x anywhere in the given file). 1)我收到警告:“警告:x是内部专有API,可能会在将来的版本中被删除”,其中x是内部专有API的一部分,但它引用的代码中的行不引用x(也没有引用x在给定文件中的任何位置)。 This happened in a few places and the line it references is in a comment block. 这发生在几个地方,它引用的行在注释块中。

2) The compile terminates with the following: 2)编译终止于以下内容:

 [javac] The system is out of resources. [javac] Consult the following stack trace for details. [javac] java.lang.StackOverflowError [javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:418) [javac] at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:460) [javac] at com.sun.tools.javac.comp.Attr.visitBinary(Attr.java:2053) [javac] at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1565) 

The relevant parameters that are in my ant script for javac are: 我的javac蚂蚁脚本中的相关参数是:

  source="1.6" target="1.6" debug="on" debuglevel="lines,vars,source" nowarn="on" fork="yes" executable="C:\\Program Files\\Java\\jdk1.7.0_04\\bin\\javac" memorymaximumsize="1500m" 

I tried changing the source and target versions. 我尝试更改源版本和目标版本。 I also tried ajusting the memory size. 我也试过调整内存大小。 It does not seem to help. 它似乎没有帮助。

(Just copying my comment to an answer, in case it turns out to be the answer.) (只是将我的评论复制到答案中,以防它成为答案。)

This may well be a Java 7 compiler bug. 这可能是Java 7编译器错误。 You can however give the compiler more memory by running javac with an argument like -Xss16M . 但是,您可以通过使用类似-Xss16M的参数运行javac为编译器提供更多内存。 This makes the thread stack size 16MB vs default of 1MB. 这使得线程堆栈大小为16MB,默认值为1MB。 It may be a viable workaround. 这可能是一个可行的解决方法。

The message about internal APIs is unrelated and can be ignored. 有关内部API的消息不相关,可以忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM