Skip to content

Commit

Permalink
Merge pull request pmd#4412 from AliAsbai:prBranchKTHProject
Browse files Browse the repository at this point in the history
[doc] Added new error msg to ConstantsInInterface pmd#4412
  • Loading branch information
adangel committed Mar 3, 2023
2 parents a24aeb1 + 39fc882 commit fb50649
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 3 additions & 0 deletions docs/pages/release_notes.md
Original file line number Diff line number Diff line change
@@ -20,10 +20,13 @@ This is a {{ site.pmd.release_type }} release.
### New and noteworthy

### Fixed Issues
* java-bestpractices
* [#1205](https://github.com/pmd/pmd/issues/1205): \[java] Improve ConstantsInInterface message to mention alternatives

### API Changes

### External Contributions
* [#4412](https://github.com/pmd/pmd/pull/4412): \[doc] Added new error msg to ConstantsInInterface - [David Ljunggren](https://github.com/dague1) (@dague1)

{% endtocmaker %}

6 changes: 3 additions & 3 deletions pmd-java/src/main/resources/category/java/bestpractices.xml
Original file line number Diff line number Diff line change
@@ -413,12 +413,12 @@ if (rst.next()) { // result is properly examined and used
<rule name="ConstantsInInterface"
language="java"
since="5.5"
message="Avoid constants in interfaces. Interfaces define types, constants are implementation details better placed in classes or enums. See Effective Java, item 19."
message="Using constants in interfaces is a bad practice."
class="net.sourceforge.pmd.lang.rule.XPathRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_java_bestpractices.html#constantsininterface">
<description>
Avoid constants in interfaces. Interfaces should define types, constants are implementation details
better placed in classes or enums. See Effective Java, item 19.
Using constants in interfaces is a bad practice. Interfaces define types, constants are implementation details better placed in classes or enums. If the constants are best viewed as members of an enumerated type, you should export them with an enum type.
For other scenarios, consider using a utility class. See Effective Java's 'Use interfaces only to define types'.
</description>
<priority>3</priority>
<properties>

0 comments on commit fb50649

Please sign in to comment.