Skip to content

Commit

Permalink
Merge pull request #4203 from adangel:issue-4177-InvalidJavaBean
Browse files Browse the repository at this point in the history
[java] New Rule InvalidJavaBean #4203
  • Loading branch information
adangel committed Nov 25, 2022
2 parents 9be37ac + 8a0a196 commit 93587f0
Show file tree
Hide file tree
Showing 8 changed files with 804 additions and 1 deletion.
10 changes: 10 additions & 0 deletions docs/pages/release_notes.md
Expand Up @@ -14,6 +14,15 @@ This is a {{ site.pmd.release_type }} release.

### New and noteworthy

#### New rules

* The new Java rule {% rule java/design/InvalidJavaBean %} identifies beans, that don't follow the [JavaBeans API specification](https://download.oracle.com/otndocs/jcp/7224-javabeans-1.01-fr-spec-oth-JSpec/),
like beans with missing getters or setters.

```xml
<rule ref="category/java/design.xml/InvalidJavaBean"/>
```

#### Renamed rules

* The Java rule {% rule java/errorprone/BeanMembersShouldSerialize %} has been renamed to
Expand Down Expand Up @@ -42,6 +51,7 @@ This is a {{ site.pmd.release_type }} release.
* [#2867](https://github.com/pmd/pmd/issues/2867): \[java] Separate pattern for test classes in ClassNamingConventions rule for Java
* [#4201](https://github.com/pmd/pmd/issues/4201): \[java] CommentDefaultAccessModifier should consider lombok's @<!-- -->Value
* java-design
* [#4177](https://github.com/pmd/pmd/issues/4177): \[java] New Rule InvalidJavaBean
* [#4188](https://github.com/pmd/pmd/issues/4188): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal false positive with Lombok's @<!-- -->NoArgsConstructor
* [#4189](https://github.com/pmd/pmd/issues/4189): \[java] AbstractClassWithoutAnyMethod should consider lombok's @<!-- -->AllArgsConstructor
* [#4200](https://github.com/pmd/pmd/issues/4200): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal should consider lombok's @<!-- -->Value
Expand Down
14 changes: 14 additions & 0 deletions pmd-core/src/main/resources/rulesets/releases/6520.xml
@@ -0,0 +1,14 @@
<?xml version="1.0"?>

<ruleset name="6520"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">
<description>
This ruleset contains links to rules that are new in PMD v6.52.0
</description>

<rule ref="category/java/design.xml/InvalidJavaBean"/>

</ruleset>

Expand Up @@ -554,7 +554,7 @@ private static String stripIndentation(String description) {

int indentation = 0;
int strLen = stripped.length();
while (Character.isWhitespace(stripped.charAt(indentation)) && indentation < strLen) {
while (indentation < strLen && Character.isWhitespace(stripped.charAt(indentation))) {
indentation++;
}

Expand Down

0 comments on commit 93587f0

Please sign in to comment.