Skip to content

Commit e50ceb4

Browse files
committed
Initial
1 parent e81722a commit e50ceb4

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

codestyle/sdk_specific_pmd_rules.xml

+28
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,34 @@
447447
</example>
448448
</rule>
449449

450+
<rule name="MissingNonnullNullableAnnotationOnPublicTypes" language="java"
451+
message="Do not forget to provide a @Nonnull or @Nullable hint on variable declarations for public types."
452+
class="net.sourceforge.pmd.lang.rule.XPathRule">
453+
<description>
454+
Do not forget to provide a @Nonnull or @Nullable hint on variable declarations for public types.
455+
</description>
456+
<priority>2</priority>
457+
<properties>
458+
<property name="xpath">
459+
<value>
460+
<![CDATA[
461+
//ClassOrInterfaceDeclaration[@Visibility="public"]/ClassOrInterfaceBody/FieldDeclaration[
462+
not(VariableDeclarator[@Initializer="true" and VariableDeclaratorId[@Final="true"]]) and
463+
not(ModifierList/Annotation[@SimpleName="Nonnull" or @SimpleName="Nullable"])
464+
]
465+
]]>
466+
</value>
467+
</property>
468+
</properties>
469+
<example>
470+
<![CDATA[
471+
public Foo {
472+
public String bar;
473+
}
474+
]]>
475+
</example>
476+
</rule>
477+
450478
<rule ref="category/java/errorprone.xml/CloseResource" />
451479
<rule ref="category/java/bestpractices.xml/UseTryWithResources" />
452480
</ruleset>

0 commit comments

Comments
 (0)