54

I need to use System.exit(0) in an application. Eclipse has the PMD plugin installed and complains about this line of code. Adding @SuppressWarnings ("PMD.DoNotCallSystemExit") remove that warning but now I get a warning that this SuppressWarnings is unsupported, despite the fact that it works.

Is there a way to resolve this?

Linus Fernandes
  • 498
  • 5
  • 30
user342495
  • 1,453
  • 1
  • 11
  • 10

1 Answers1

88

To get Eclipse to not flag the @SuppressWarnings("PMD") annotation, look under the menu headings Java -> Compiler -> Errors/Warnings -> Annotations -> Unhandled Token in '@SuppressWarnings' and set it to ignore.

Right on the PMD page.

Carlos Macasaet
  • 1,176
  • 7
  • 23
user342495
  • 1,453
  • 1
  • 11
  • 10
  • 12
    This has the disadvantage that Eclipse does not report any unsupported token at all, and as reported here, the list is hardcoded: http://www.coderjunk.com/0JJqegPVWj/how-to-add-custom-suppresswarnings-token-in-eclipse.html – Nicolas Jul 16 '15 at 14:53
  • 13
    There is a bug report on Eclipse project: feel free to support this issue: https://bugs.eclipse.org/bugs/show_bug.cgi?id=392045 – Sebien Mar 23 '16 at 08:50