Commit e50ceb4 1 parent e81722a commit e50ceb4 Copy full SHA for e50ceb4
File tree 1 file changed +28
-0
lines changed
1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change 447
447
</example >
448
448
</rule >
449
449
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
+
450
478
<rule ref =" category/java/errorprone.xml/CloseResource" />
451
479
<rule ref =" category/java/bestpractices.xml/UseTryWithResources" />
452
480
</ruleset >
You can’t perform that action at this time.
0 commit comments