Java编译器警告会影响编译时间吗?

时间:2016-04-04 15:14:51

标签: java performance compilation compiler-warnings

我有一个遗留项目有几千个编译器警告(原始类型,不必要的@SuppressWarnings,未使用的导入等) - 该项目有大约5000个Java源文件。这些警告是否可能对编译时间产生重大影响?

请注意:我很清楚,删除编译器警告只是以提高性能并不是一个很好的理由。我希望摆脱警告,以便更容易添加新代码,减少潜在的错误等。但在这种情况下,我要问的是,如果有大量警告,编译过程是否需要更长时间。< /强>

2 个答案:

答案 0 :(得分:3)

没有;不显着。寻址编译器警告的价值来自减少项目维护时间,即程序员的时间,而不是编译时间。通过解决这些警告,您可以更清楚地了解出现的问题,而不是迷失在警告的海洋中......

答案 1 :(得分:0)

Are these warnings likely to have any significant impact on the compile time?

No.

In a comment to Jans answer you wrote

it's literally asking whether there is a measurable impact on compilation time if your code contains warnings vs whether it doesn't

Yes, there will be a measurable impact but it's likely to be very very small. This comment makes me think you're asking two different questions?

Jans answer, at least to me is absolutely correct.