如何抑制特定目录或文件(如生成的代码)的Java警告 [英] How to suppress Java warnings for specific directories or files such as generated code
问题描述
@SuppressWarning
注释来抑制特定元素中的特定警告,但是当解析器生成器再次运行时,我手动添加的任何注释都将丢失。有没有办法配置Eclipse来禁止特定文件或目录的警告?从版本3.8开始M6,Eclipse确切地说:JDT)具有内置的功能。可以通过项目的构建路径进行配置:项目属性> Java构建路径>编译器>源代码
这里发布: Eclipse 3.8和4.2 M6 - 新功能,值得注意的是, a>,称为选择性地忽略来自源文件夹的错误/警告。这也是截图来自的地方。这是以前关联的错误220928 中开发的新功能。 p>
I'm using a parser generator that creates somewhat ugly code. As a result my Eclipse project has several dozen warnings emanating from generated source files. I know I can use the @SuppressWarning
annotation to suppress particular warnings in particular elements, but any annotations I add by hand will be lost when the parser generator runs again. Is there a way to configure Eclipse to suppress warnings for a particular file or directory?
Starting with version 3.8 M6, Eclipse (to be exact: the JDT) has built-in functionality for this. It is configurable through a project's build path: Project properties > Java Build Path > Compiler > Source
Announced here: Eclipse 3.8 and 4.2 M6 - New and Noteworthy, called Selectively ignore errors/warnings from source folders. That's also where the screenshot is from. This is the new feature developed on the previously linked Bug 220928.
这篇关于如何抑制特定目录或文件(如生成的代码)的Java警告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!