From 1a62ddffad8bf4e9beb30205a40f45ec22bb2cff Mon Sep 17 00:00:00 2001 From: Scrsloota <1912125562@qq.com> Date: Sat, 28 May 2022 00:17:11 +0800 Subject: [PATCH 1/9] fix AvoidFieldNameMatchingMethodName without enum --- .../AvoidFieldNameMatchingMethodNameRule.java | 54 +++++++++++-------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java index a84a2b8b3d..9fd52b984a 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java @@ -13,8 +13,11 @@ import java.util.Set; import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; +import net.sourceforge.pmd.lang.java.ast.ASTEnumBody; +import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; +import net.sourceforge.pmd.lang.java.ast.JavaNode; import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule; public class AvoidFieldNameMatchingMethodNameRule extends AbstractJavaRule { @@ -28,29 +31,36 @@ public class AvoidFieldNameMatchingMethodNameRule extends AbstractJavaRule { } @Override - public Object visit(ASTClassOrInterfaceBody node, Object data) { - int n = node.getNumChildren(); - List fields = new ArrayList<>(); - Set methodNames = new HashSet<>(); - for (int i = 0; i < n; i++) { - Node child = node.getChild(i); - if (child.getNumChildren() == 0) { - continue; - } - child = child.getChild(child.getNumChildren() - 1); - if (child instanceof ASTFieldDeclaration) { - fields.add((ASTFieldDeclaration) child); - } else if (child instanceof ASTMethodDeclaration) { - methodNames.add(((ASTMethodDeclaration) child).getName().toLowerCase(Locale.ROOT)); - } - } - for (ASTFieldDeclaration field : fields) { - String varName = field.getVariableName().toLowerCase(Locale.ROOT); - if (methodNames.contains(varName)) { - addViolation(data, field, field.getVariableName()); - } - } + public Object visit(ASTEnumDeclaration node, Object data) { return super.visit(node, data); } + @Override + public Object visit(JavaNode node, Object data) { + if (node instanceof ASTClassOrInterfaceBody || node instanceof ASTEnumBody) { + int n = node.getNumChildren(); + List fields = new ArrayList<>(); + Set methodNames = new HashSet<>(); + for (int i = 0; i < n; i++) { + Node child = node.getChild(i); + if (child.getNumChildren() == 0) { + continue; + } + child = child.getChild(child.getNumChildren() - 1); + if (child instanceof ASTFieldDeclaration) { + fields.add((ASTFieldDeclaration) child); + } else if (child instanceof ASTMethodDeclaration) { + methodNames.add(((ASTMethodDeclaration) child).getName().toLowerCase(Locale.ROOT)); + } + } + for (ASTFieldDeclaration field : fields) { + String varName = field.getVariableName().toLowerCase(Locale.ROOT); + if (methodNames.contains(varName)) { + addViolation(data, field, field.getVariableName()); + } + } + return super.visit(node, data); + } + return super.visit(node, data); + } } From 7261b7fd10842fc15c3aab73de1ea8d0c7944dcc Mon Sep 17 00:00:00 2001 From: Scrsloota <1912125562@qq.com> Date: Sat, 28 May 2022 00:17:32 +0800 Subject: [PATCH 2/9] add test cases --- .../xml/AvoidFieldNameMatchingMethodName.xml | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml index 138d598230..ad0170102a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml @@ -60,6 +60,48 @@ public class Bar { + + + + Test1 in Enum + 1 + + + + + Test2 in Enum + 0 + + + + + Test3 in Enum + 0 + From 6111951e6cdfd447fb8889c4fd6534c8e31fdab4 Mon Sep 17 00:00:00 2001 From: dalizi007 <11912017@mail.sustech.edu.cn> Date: Sat, 28 May 2022 23:55:47 +0800 Subject: [PATCH 3/9] [java] Add the method "buz" definition #3937 --- .../java/rule/errorprone/xml/AvoidDuplicateLiterals.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidDuplicateLiterals.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidDuplicateLiterals.xml index e86665b847..619eb56c84 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidDuplicateLiterals.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidDuplicateLiterals.xml @@ -15,6 +15,7 @@ public class Foo { buz("Howdy"); buz("Howdy"); } + private void buz(String x) {} } ]]> @@ -27,6 +28,7 @@ public class Foo { private void bar() { buz(2); } + private void buz(int x) {} } ]]> @@ -86,6 +88,7 @@ public class Foo { buz("Howdy"); buz("Howdy"); } + private void buz(String x) {} } ]]> @@ -100,6 +103,7 @@ public class Foo { buz("Howdy"); buz("Howdy"); buz("Howdy"); buz("Howdy"); buz("foo"); buz("foo"); buz("foo"); buz("foo"); } + private void buz(String x) {} } ]]> @@ -115,6 +119,7 @@ public class Foo { buz("Howdy"); buz("Howdy"); buz("Howdy"); buz("Howdy"); buz("foo"); buz("foo"); buz("foo"); buz("foo"); } + private void buz(String x) {} } ]]> @@ -128,6 +133,7 @@ public class Foo { private void bar() { buz("Howdy"); buz("Howdy"); buz("Howdy"); buz("Howdy"); } + private void buz(String x) {} } ]]> @@ -141,6 +147,7 @@ public class Foo { private void bar() { buz("foo"); buz("foo"); buz("foo"); buz("foo"); } + private void buz(String x) {} } ]]> @@ -154,6 +161,7 @@ public class Foo { buz("foo"); buz("foo"); buz("foo"); buz("foo"); buz("fo"); buz("fo"); buz("fo"); buz("fo"); } + private void buz(String x) {} } ]]> From 25e59bc2eedced36081c3beef321d308440d4396 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 Jun 2022 11:35:19 +0200 Subject: [PATCH 4/9] [doc] Update release notes (#3937, #3993) --- docs/pages/release_notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..1eb0bab3e3 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,10 +15,13 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* java-errorprone + * [#3937](https://github.com/pmd/pmd/issues/3937): \[java] AvoidDuplicateLiterals - uncompilable test cases ### API Changes ### External Contributions +* [#3993](https://github.com/pmd/pmd/pull/3993): \[java] AvoidDuplicateLiterals - Add the method "buz" definition to test cases - [@dalizi007](https://github.com/dalizi007) {% endtocmaker %} From 74c9ebb15afe015ec4d610a9dac21eab4a60b3bd Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 2 Jun 2022 11:35:42 +0200 Subject: [PATCH 5/9] Add @dalizi007 as a contributor --- .all-contributorsrc | 9 ++++++ docs/pages/pmd/projectdocs/credits.md | 41 ++++++++++++++------------- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 85095b18fe..5357d8fad6 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6684,6 +6684,15 @@ "contributions": [ "bug" ] + }, + { + "login": "dalizi007", + "name": "dalizi007", + "avatar_url": "https://avatars.githubusercontent.com/u/90743616?v=4", + "profile": "https://github.com/dalizi007", + "contributions": [ + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 48913f3d00..c01402c827 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -770,186 +770,187 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
d1ss0nanz

๐Ÿ› +
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ›
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ› -
dependabot[bot]

๐Ÿ’ป ๐Ÿ› +
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ›
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ› -
dzeigler

๐Ÿ› +
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป
foxmason

๐Ÿ›
frankegabor

๐Ÿ› -
frankl

๐Ÿ› +
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ›
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ› -
haigsn

๐Ÿ› +
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ›
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ› -
itaigilo

๐Ÿ› +
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ›
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป -
josemanuelrolon

๐Ÿ’ป ๐Ÿ› +
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ›
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ› -
khalidkh

๐Ÿ› +
khalidkh

๐Ÿ›
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lihuaib

๐Ÿ›
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป -
lukelukes

๐Ÿ’ป +
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ›
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ› -
milossesic

๐Ÿ› +
milossesic

๐Ÿ›
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ› -
nicolas-harraudeau-sonarsource

๐Ÿ› +
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pallavi agarwal

๐Ÿ› -
parksungrin

๐Ÿ› +
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ› -
poojasix

๐Ÿ› +
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ› -
recdevs

๐Ÿ› +
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ› -
sabi0

๐Ÿ› +
sabi0

๐Ÿ›
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
simeonKondr

๐Ÿ›
snajberk

๐Ÿ› -
sniperrifle2004

๐Ÿ› +
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ› -
svenfinitiv

๐Ÿ› +
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ› -
tprouvot

๐Ÿ› +
tprouvot

๐Ÿ›
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ› -
wjljack

๐Ÿ› +
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ› -
yalechen-cyw3

๐Ÿ› +
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ› -
zzzzfeng

๐Ÿ› +
zzzzfeng

๐Ÿ›
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ› From 051951e852f4f7753ffc51f0f3cc005b0ba9a2da Mon Sep 17 00:00:00 2001 From: Scrsloota <1912125562@qq.com> Date: Thu, 2 Jun 2022 23:43:31 +0800 Subject: [PATCH 6/9] change to avoid instanceof checks --- .../AvoidFieldNameMatchingMethodNameRule.java | 56 ++++++++++--------- .../xml/AvoidFieldNameMatchingMethodName.xml | 6 +- 2 files changed, 32 insertions(+), 30 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java index 9fd52b984a..5e5dd5de17 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/errorprone/AvoidFieldNameMatchingMethodNameRule.java @@ -14,7 +14,6 @@ import net.sourceforge.pmd.lang.ast.Node; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumBody; -import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTFieldDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.JavaNode; @@ -31,36 +30,39 @@ public class AvoidFieldNameMatchingMethodNameRule extends AbstractJavaRule { } @Override - public Object visit(ASTEnumDeclaration node, Object data) { + public Object visit(ASTClassOrInterfaceBody node, Object data) { + handleClassOrEnum(node, data); return super.visit(node, data); } @Override - public Object visit(JavaNode node, Object data) { - if (node instanceof ASTClassOrInterfaceBody || node instanceof ASTEnumBody) { - int n = node.getNumChildren(); - List fields = new ArrayList<>(); - Set methodNames = new HashSet<>(); - for (int i = 0; i < n; i++) { - Node child = node.getChild(i); - if (child.getNumChildren() == 0) { - continue; - } - child = child.getChild(child.getNumChildren() - 1); - if (child instanceof ASTFieldDeclaration) { - fields.add((ASTFieldDeclaration) child); - } else if (child instanceof ASTMethodDeclaration) { - methodNames.add(((ASTMethodDeclaration) child).getName().toLowerCase(Locale.ROOT)); - } - } - for (ASTFieldDeclaration field : fields) { - String varName = field.getVariableName().toLowerCase(Locale.ROOT); - if (methodNames.contains(varName)) { - addViolation(data, field, field.getVariableName()); - } - } - return super.visit(node, data); - } + public Object visit(ASTEnumBody node, Object data) { + handleClassOrEnum(node, data); return super.visit(node, data); } + + private void handleClassOrEnum(JavaNode node, Object data) { + int n = node.getNumChildren(); + List fields = new ArrayList<>(); + Set methodNames = new HashSet<>(); + for (int i = 0; i < n; i++) { + Node child = node.getChild(i); + if (child.getNumChildren() == 0) { + continue; + } + child = child.getChild(child.getNumChildren() - 1); + if (child instanceof ASTFieldDeclaration) { + fields.add((ASTFieldDeclaration) child); + } else if (child instanceof ASTMethodDeclaration) { + methodNames.add(((ASTMethodDeclaration) child).getName().toLowerCase(Locale.ROOT)); + } + } + for (ASTFieldDeclaration field : fields) { + String varName = field.getVariableName().toLowerCase(Locale.ROOT); + if (methodNames.contains(varName)) { + addViolation(data, field, field.getVariableName()); + } + } + } + } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml index ad0170102a..4cab17b54a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidFieldNameMatchingMethodName.xml @@ -65,7 +65,7 @@ public interface Bar { - Test1 in Enum + Test1 in Enum #3936 1 - Test2 in Enum + Test2 in Enum #3936 0 - Test3 in Enum + Test3 in Enum #3936 0 Date: Sat, 4 Jun 2022 11:00:30 +0200 Subject: [PATCH 7/9] chore: Fix project.parent.relativePath in pom.xml It must point to a file, pointing to a directory is not valid. --- pmd-apex-jorje/pom.xml | 2 +- pmd-apex/pom.xml | 2 +- pmd-core/pom.xml | 2 +- pmd-cpp/pom.xml | 2 +- pmd-cs/pom.xml | 2 +- pmd-dart/pom.xml | 2 +- pmd-dist/pom.xml | 2 +- pmd-doc/pom.xml | 2 +- pmd-fortran/pom.xml | 2 +- pmd-go/pom.xml | 2 +- pmd-groovy/pom.xml | 2 +- pmd-html/pom.xml | 2 +- pmd-java/pom.xml | 2 +- pmd-java8/pom.xml | 2 +- pmd-javascript/pom.xml | 2 +- pmd-jsp/pom.xml | 2 +- pmd-kotlin/pom.xml | 2 +- pmd-lang-test/pom.xml | 2 +- pmd-lua/pom.xml | 2 +- pmd-matlab/pom.xml | 2 +- pmd-modelica/pom.xml | 2 +- pmd-objectivec/pom.xml | 2 +- pmd-perl/pom.xml | 2 +- pmd-php/pom.xml | 2 +- pmd-plsql/pom.xml | 2 +- pmd-python/pom.xml | 2 +- pmd-ruby/pom.xml | 2 +- pmd-scala-modules/pmd-scala-common/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.12/pom.xml | 2 +- pmd-scala-modules/pmd-scala_2.13/pom.xml | 2 +- pmd-scala/pom.xml | 2 +- pmd-swift/pom.xml | 2 +- pmd-test/pom.xml | 2 +- pmd-visualforce/pom.xml | 2 +- pmd-vm/pom.xml | 2 +- pmd-xml/pom.xml | 2 +- 36 files changed, 36 insertions(+), 36 deletions(-) diff --git a/pmd-apex-jorje/pom.xml b/pmd-apex-jorje/pom.xml index 3666d840ce..b5a177525f 100644 --- a/pmd-apex-jorje/pom.xml +++ b/pmd-apex-jorje/pom.xml @@ -9,7 +9,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-apex/pom.xml b/pmd-apex/pom.xml index 9eebf20f95..9cbd113a4e 100644 --- a/pmd-apex/pom.xml +++ b/pmd-apex/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml index 09da20cebe..f86c7c1c49 100644 --- a/pmd-core/pom.xml +++ b/pmd-core/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-cpp/pom.xml b/pmd-cpp/pom.xml index 4a7287fcbf..36487444eb 100644 --- a/pmd-cpp/pom.xml +++ b/pmd-cpp/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-cs/pom.xml b/pmd-cs/pom.xml index 2de4e3d6b7..96e8cb895a 100644 --- a/pmd-cs/pom.xml +++ b/pmd-cs/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-dart/pom.xml b/pmd-dart/pom.xml index 35c30a87c3..f1196e2faa 100644 --- a/pmd-dart/pom.xml +++ b/pmd-dart/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index edaf2e9a89..1181aecfaf 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -9,7 +9,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml index 5721c1a635..684f809c62 100644 --- a/pmd-doc/pom.xml +++ b/pmd-doc/pom.xml @@ -9,7 +9,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-fortran/pom.xml b/pmd-fortran/pom.xml index 5e5c483a30..4a31b11c06 100644 --- a/pmd-fortran/pom.xml +++ b/pmd-fortran/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-go/pom.xml b/pmd-go/pom.xml index 9ec6b42466..9389feafff 100644 --- a/pmd-go/pom.xml +++ b/pmd-go/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-groovy/pom.xml b/pmd-groovy/pom.xml index 2ccd52164f..4608e3662f 100644 --- a/pmd-groovy/pom.xml +++ b/pmd-groovy/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-html/pom.xml b/pmd-html/pom.xml index b77f7d296d..f536a558ee 100644 --- a/pmd-html/pom.xml +++ b/pmd-html/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml index ecb14302c2..c94e568db0 100644 --- a/pmd-java/pom.xml +++ b/pmd-java/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-java8/pom.xml b/pmd-java8/pom.xml index c367c8064a..7f75518ed4 100644 --- a/pmd-java8/pom.xml +++ b/pmd-java8/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index 09725d447e..0d2edc5e3a 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml index 1fd17a18c2..79342c8ff1 100644 --- a/pmd-jsp/pom.xml +++ b/pmd-jsp/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-kotlin/pom.xml b/pmd-kotlin/pom.xml index 939c94f0e3..6234df66e7 100644 --- a/pmd-kotlin/pom.xml +++ b/pmd-kotlin/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-lang-test/pom.xml b/pmd-lang-test/pom.xml index ce1bc5067e..99a590c89b 100644 --- a/pmd-lang-test/pom.xml +++ b/pmd-lang-test/pom.xml @@ -13,7 +13,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-lua/pom.xml b/pmd-lua/pom.xml index b7f3fbe731..ef459787d3 100644 --- a/pmd-lua/pom.xml +++ b/pmd-lua/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-matlab/pom.xml b/pmd-matlab/pom.xml index 0de710099a..b6dffb8afa 100644 --- a/pmd-matlab/pom.xml +++ b/pmd-matlab/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-modelica/pom.xml b/pmd-modelica/pom.xml index 341803ec4e..bee6eb4ece 100644 --- a/pmd-modelica/pom.xml +++ b/pmd-modelica/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-objectivec/pom.xml b/pmd-objectivec/pom.xml index cedfce8126..2b1bede214 100644 --- a/pmd-objectivec/pom.xml +++ b/pmd-objectivec/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-perl/pom.xml b/pmd-perl/pom.xml index 558fa427c8..83f957ad73 100644 --- a/pmd-perl/pom.xml +++ b/pmd-perl/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-php/pom.xml b/pmd-php/pom.xml index 782f861703..c4a2e6e040 100644 --- a/pmd-php/pom.xml +++ b/pmd-php/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-plsql/pom.xml b/pmd-plsql/pom.xml index c0a1762555..2242099ad1 100644 --- a/pmd-plsql/pom.xml +++ b/pmd-plsql/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-python/pom.xml b/pmd-python/pom.xml index 1161024852..6406fb7bc5 100644 --- a/pmd-python/pom.xml +++ b/pmd-python/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-ruby/pom.xml b/pmd-ruby/pom.xml index 5bc68ba973..e0385b000c 100644 --- a/pmd-ruby/pom.xml +++ b/pmd-ruby/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-scala-modules/pmd-scala-common/pom.xml b/pmd-scala-modules/pmd-scala-common/pom.xml index 20ace8b9c8..c5327d8381 100644 --- a/pmd-scala-modules/pmd-scala-common/pom.xml +++ b/pmd-scala-modules/pmd-scala-common/pom.xml @@ -9,7 +9,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../.. + ../../pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.12/pom.xml b/pmd-scala-modules/pmd-scala_2.12/pom.xml index 4765990084..b6a62cd14c 100644 --- a/pmd-scala-modules/pmd-scala_2.12/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.12/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd-scala-common 6.47.0-SNAPSHOT - ../pmd-scala-common + ../pmd-scala-common/pom.xml diff --git a/pmd-scala-modules/pmd-scala_2.13/pom.xml b/pmd-scala-modules/pmd-scala_2.13/pom.xml index 9b5c50f976..43ed00eb17 100644 --- a/pmd-scala-modules/pmd-scala_2.13/pom.xml +++ b/pmd-scala-modules/pmd-scala_2.13/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd-scala-common 6.47.0-SNAPSHOT - ../pmd-scala-common + ../pmd-scala-common/pom.xml diff --git a/pmd-scala/pom.xml b/pmd-scala/pom.xml index bc1c3e9ccd..9a0020aa0f 100644 --- a/pmd-scala/pom.xml +++ b/pmd-scala/pom.xml @@ -10,7 +10,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-swift/pom.xml b/pmd-swift/pom.xml index 10032db400..82a44caa83 100644 --- a/pmd-swift/pom.xml +++ b/pmd-swift/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-test/pom.xml b/pmd-test/pom.xml index b8757a44a0..c2540c1888 100644 --- a/pmd-test/pom.xml +++ b/pmd-test/pom.xml @@ -9,7 +9,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml index 4e2ef9d4ba..acdf585467 100644 --- a/pmd-visualforce/pom.xml +++ b/pmd-visualforce/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-vm/pom.xml b/pmd-vm/pom.xml index bfbb62269f..3c69ab2437 100644 --- a/pmd-vm/pom.xml +++ b/pmd-vm/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml diff --git a/pmd-xml/pom.xml b/pmd-xml/pom.xml index 26c8a9faf8..7fe4f69fe5 100644 --- a/pmd-xml/pom.xml +++ b/pmd-xml/pom.xml @@ -8,7 +8,7 @@ net.sourceforge.pmd pmd 6.47.0-SNAPSHOT - ../ + ../pom.xml From 62d27c07b40985ecc1ed8ab3b87647ac9d39f1a5 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 4 Jun 2022 15:14:35 +0200 Subject: [PATCH 8/9] [doc] Update release notes (#3936, #3985) --- docs/pages/release_notes.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 1eb0bab3e3..fe77034c8c 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -16,11 +16,13 @@ This is a {{ site.pmd.release_type }} release. ### Fixed Issues * java-errorprone + * [#3936](https://github.com/pmd/pmd/issues/3936): \[java] AvoidFieldNameMatchingMethodName should consider enum class * [#3937](https://github.com/pmd/pmd/issues/3937): \[java] AvoidDuplicateLiterals - uncompilable test cases ### API Changes ### External Contributions +* [#3985](https://github.com/pmd/pmd/pull/3985): \[java] Fix false negative problem about Enum in AvoidFieldNameMatchingMethodName #3936 - [@Scrsloota](https://github.com/Scrsloota) * [#3993](https://github.com/pmd/pmd/pull/3993): \[java] AvoidDuplicateLiterals - Add the method "buz" definition to test cases - [@dalizi007](https://github.com/dalizi007) {% endtocmaker %} From 021c5a25e8fda96f760f005686328f3f487e146e Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Sat, 4 Jun 2022 15:49:01 +0200 Subject: [PATCH 9/9] chore: Check for SNAPSHOT build tools and other SNAPSHOTs --- do-release.sh | 8 ++++++++ pom.xml | 34 +++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/do-release.sh b/do-release.sh index 5cd900bf32..3ddb331bbd 100755 --- a/do-release.sh +++ b/do-release.sh @@ -72,6 +72,14 @@ export RELEASE_VERSION export DEVELOPMENT_VERSION export CURRENT_BRANCH +# check for SNAPSHOT version of pmd.build-tools.version +BUILD_TOOLS_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=pmd.build-tools.version -q -DforceStdout) +BUILD_TOOLS_VERSION_RELEASE=${BUILD_TOOLS_VERSION%-SNAPSHOT} +if [ "${BUILD_TOOLS_VERSION}" != "${BUILD_TOOLS_VERSION_RELEASE}" ]; then + echo "Error: version pmd.build-tools.version is ${BUILD_TOOLS_VERSION} - snapshot is not allowed" + exit 1 +fi + RELEASE_RULESET="pmd-core/src/main/resources/rulesets/releases/${RELEASE_VERSION//\./}.xml" echo "* Update date info in **docs/_config.yml**." diff --git a/pom.xml b/pom.xml index c5119da86e..f9a643d105 100644 --- a/pom.xml +++ b/pom.xml @@ -364,7 +364,7 @@ org.apache.maven.plugins maven-enforcer-plugin - 3.0.0-M2 + 3.0.0 org.apache.maven.plugins @@ -431,6 +431,11 @@ + + org.apache.maven.plugins + maven-site-plugin + 4.0.0-M1 + org.codehaus.mojo versions-maven-plugin @@ -495,6 +500,33 @@ + + enforce-no-snapshots + + enforce + + + + + No Snapshots Allowed! + true + + + + + + enforce-plugin-versions + + enforce + + + + + Best Practice is to always define plugin versions! + + + +