Do not generate violation for empty SuppressWarnings. #1187
This commit is contained in:
parent
4f44299d43
commit
7b74f65b10
2
pom.xml
2
pom.xml
|
|
@ -685,7 +685,7 @@
|
|||
<regex><pattern>.*.checks.DescendantTokenCheck</pattern><branchRate>91</branchRate><lineRate>96</lineRate></regex>
|
||||
<regex><pattern>.*.checks.NewlineAtEndOfFileCheck</pattern><branchRate>83</branchRate><lineRate>88</lineRate></regex>
|
||||
<regex><pattern>.*.checks.OuterTypeFilenameCheck</pattern><branchRate>71</branchRate><lineRate>92</lineRate></regex>
|
||||
<regex><pattern>.*.checks.SuppressWarningsHolder</pattern><branchRate>70</branchRate><lineRate>90</lineRate></regex>
|
||||
<regex><pattern>.*.checks.SuppressWarningsHolder</pattern><branchRate>75</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.checks.TodoCommentCheck</pattern><branchRate>100</branchRate><lineRate>92</lineRate></regex>
|
||||
<regex><pattern>.*.checks.TrailingCommentCheck</pattern><branchRate>90</branchRate><lineRate>93</lineRate></regex>
|
||||
<regex><pattern>.*.checks.TranslationCheck</pattern><branchRate>81</branchRate><lineRate>83</lineRate></regex>
|
||||
|
|
|
|||
|
|
@ -263,8 +263,7 @@ public class SuppressWarningsHolder
|
|||
}
|
||||
}
|
||||
}
|
||||
if (values == null) {
|
||||
log(ast, "suppress.warnings.missing.value");
|
||||
if (isAnnotationEmpty(values)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -306,6 +305,14 @@ public class SuppressWarningsHolder
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param values list of values in the annotation
|
||||
* @return whether annotation is empty or contains some values
|
||||
*/
|
||||
private boolean isAnnotationEmpty(List<String> values) {
|
||||
return values == null;
|
||||
}
|
||||
|
||||
/**
|
||||
* get target of annotation
|
||||
* @param ast the AST node to get the child of
|
||||
|
|
|
|||
|
|
@ -28,3 +28,9 @@ public class InputSuppressWarningsHolder {
|
|||
@SuppressWarnings({"unused", true ? "unused" : ""})
|
||||
int l;
|
||||
}
|
||||
|
||||
class CustomSuppressWarnings {
|
||||
@SuppressWarnings
|
||||
private @interface SuppressWarnings {
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue