Eclipse复制批注@SurpressWarnings for PMD [英] Eclipse duplication annotation @SurpressWarnings for PMD

查看:66
本文介绍了Eclipse复制批注@SurpressWarnings for PMD的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为班级禁用几个任意的PMD警告.

I am trying to disable several arbitrary PMD warnings for my class.

如何列出要忽略的几个PMD规则?我无法在Google上找到.

How can I list several PMD rules to be ignored? I was not able to find with Google.

@SuppressWarnings("PMD.OnlyOneReturn")
@SuppressWarnings("PMD.ShortVariable")
public class MyClass {

它给出了Eclipse编译时错误:

it gives Eclipse compile time error:

Duplicate annotation @SurpressWarnings

这是可编译但被忽略的

@SuppressWarnings("PMD.OnlyOneReturn, PMD.ShortVariable")

@SuppressWarnings("PMD.OnlyOneReturn", "PMD.ShortVariable")

结果是

Syntax error on token ,

Eclipse已配置为接受PMD类型:

Eclipse is configured to accept PMD type:

不受支持的@SuppressWarnings("PMD.DoNotCallSystemExit")

推荐答案

您必须在数组中列出它们.

You have to list them in an array.

赞:

@SuppressWarnings({
    "PMD.OnlyOneReturn",
    "PMD.ShortVariable"  })

这篇关于Eclipse复制批注@SurpressWarnings for PMD的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆