简体   繁体   中英

Is there a way to suppress the “The type (…) collides with a package” warning in Eclipse?

This question is closely related to java-class-name-same-as-the-nested-package-name . My specific question here is: How can I disable/suppress that warning in Eclipse?

Some remarks:

  • I cannot change the code, it's a pattern widely used by Jenkins.
  • It seems the Java Language Specification (JLS) allows it - anyway javac doesn't mark it as error.
  • The reason for the warning is that a class and a resource folder have the same name (I am not sure if a resource folder establishes a package according to JLS).
  • I want to get that warning away because it hides other warnings.

Unfortunately it's not currently possible to disable that warning in Eclipse. There is an open feature request to make it possible , however it has had no action since 2012.

For Jenkins plugins, since there are no resources to compile in src/main/resources, in Eclipse, I toggled the 'Ignore optional compile problems' to Yes. That will remove the warning.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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