diff --git a/.all-contributorsrc b/.all-contributorsrc
index 004e776cd1..254b9df0f7 100644
--- a/.all-contributorsrc
+++ b/.all-contributorsrc
@@ -6493,6 +6493,24 @@
"contributions": [
"code"
]
+ },
+ {
+ "login": "vgalloy",
+ "name": "Vincent Galloy",
+ "avatar_url": "https://avatars.githubusercontent.com/u/11443605?v=4",
+ "profile": "https://github.com/vgalloy",
+ "contributions": [
+ "code"
+ ]
+ },
+ {
+ "login": "squaresurf",
+ "name": "Daniel Paul Searles",
+ "avatar_url": "https://avatars.githubusercontent.com/u/863076?v=4",
+ "profile": "https://github.com/squaresurf",
+ "contributions": [
+ "code"
+ ]
}
],
"contributorsPerLine": 7,
diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md
index fea5045f18..bfabdb8a21 100644
--- a/docs/pages/pmd/projectdocs/credits.md
+++ b/docs/pages/pmd/projectdocs/credits.md
@@ -188,741 +188,743 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Dan Rollo π |
Dan Ziemba π |
Daniel Jipa π |
+ Daniel Paul Searles π» |
Daniel Reigada π |
Danilo Pianini π |
Darko π |
- David π |
+ David π |
David Atkinson π |
David BurstrΓΆm π» π |
David GoatΓ© π |
David Golpira π |
David KovaΕΓk π |
David M. Karr (fullname at gmail.com) π |
- David Renz π» π |
+ David Renz π» π |
David Renz π |
Deleted user π |
Dell Green π |
Dem Pilafian π |
Den π |
Denis Borovikov π» π |
- Dennie Reniers π» π |
+ Dennie Reniers π» π |
Dennis Kieselhorst π |
Derek P. Moore π |
Dichotomia π |
Dionisio CortΓ©s FernΓ‘ndez π» π |
Dmitri Bourlatchkov π |
Dmitriy Kuzmin π |
- Dmytro Dashenkov π |
+ Dmytro Dashenkov π |
Drew Hall π |
Dumitru Postoronca π |
Dylan Adams π |
Eden Hao π |
Egor Bredikhin π |
Elan P. Kugelmass π |
- Elder S. π |
+ Elder S. π |
Emile π |
Eric π |
Eric Kintzer π |
Eric Perret π |
Eric Squires π |
Erich L Foster π |
- Erik Bleske π |
+ Erik Bleske π |
Ernst Reissner π |
F.W. Dekker π |
Facundo π |
Federico Giust π |
Fedor Sherstobitov π |
Felix Lampe π |
- Filip Golonka π |
+ Filip Golonka π |
Filipe Esperandio π» π |
Francesco la Torre π |
Francisco Duarte π |
Frieder Bluemle π |
Frits Jalvingh π» π |
G. Bazior π |
- Gabe Henkes π |
+ Gabe Henkes π |
Genoud Magloire π |
Geoffrey555 π |
Georg Romstorfer π |
Gio π |
Gol π |
Gonzalo Exequiel Ibars Ingman π» π |
- GooDer π |
+ GooDer π |
Gregor Riegler π |
Grzegorz Olszewski π |
Gunther Schrijvers π» π |
Gustavo Krieger π |
Guy Elsmore-Paddock π |
GΓΆrkem MΓΌlayim π |
- Hanzel Godinez π |
+ Hanzel Godinez π |
Harsh Kukreja π |
Heber π |
Henning Schmiedehausen π» π |
Henning von Bargen π» |
HervΓ© Boutemy π |
Himanshu Pandey π |
- Hokwang Lee π |
+ Hokwang Lee π |
Hooperbloob π» |
Hung PHAN π |
IDoCodingStuffs π» π |
Iccen Gan π |
Ignacio Mariano Tirabasso π |
Igor Melnichenko π |
- Igor Moreno π |
+ Igor Moreno π |
Intelesis-MS π |
Iroha_ π |
Ishan Srivastava π |
Ivano Guerini π |
Ivar Andreas Bonsaksen π |
Ivo Ε mΓd π |
- JJengility π |
+ JJengility π |
Jake Hemmerle π |
James Harrison π |
Jan π |
Jan Aertgeerts π» π |
Jan BrΓΌmmer π |
Jan TΕΓska π |
- Jan-Lukas Else π |
+ Jan-Lukas Else π |
Jason Williams π |
Jean-Paul Mayer π |
Jean-Simon Larochelle π |
Jeff Bartolotta π» π |
Jeff Hube π» π |
Jeff Jensen π |
- Jeff May π |
+ Jeff May π |
Jens Gerdes π |
Jeroen Borgers π |
Jerome Russ π |
Jiri Pejchal π |
Jithin Sunny π |
JiΕΓ Ε korpil π |
- Joao Machado π |
+ Joao Machado π |
Jochen Krauss π |
Johan Hammar π |
John Karp π |
John Zhang π |
John-Teng π» π |
Jon Moroney π» π |
- Jonas Geiregat π |
+ Jonas Geiregat π |
Jonathan Wiesel π» π |
Jordan π |
Jordi Llach π |
Jorge SolΓ³rzano π |
JorneVL π |
Jose Palafox π |
- Jose Stovall π |
+ Jose Stovall π |
Joseph π» |
Joseph Heenan π |
Josh Feingold π» π |
Josh Holthaus π |
Joshua S Arquilevich π |
JoΓ£o Ferreira π» π |
- JoΓ£o Pedro Schmitt π |
+ JoΓ£o Pedro Schmitt π |
Juan MartΓn Sotuyo Dodero π» π π π§ |
Juan Pablo Civile π |
Julian Voronetsky π |
Julien π |
Julius π |
JustPRV π |
- JΓΆrn Huxhorn π |
+ JΓΆrn Huxhorn π |
KThompso π |
Kai Amundsen π |
Karl-Andero Mere π |
Karl-Philipp Richter π |
Karsten Silz π |
Kazuma Watanabe π |
- Kev π |
+ Kev π |
Keve MΓΌller π |
Kevin Guerra π» |
Kevin Jones π |
Kevin Wayne π |
Kieran Black π |
Kirill Zubov π |
- Kirk Clemens π» π |
+ Kirk Clemens π» π |
Klaus Hartl π |
Koen Van Looveren π |
Kris Scheibe π» π |
Kunal Thanki π |
Larry Diamond π» π |
Lars Knickrehm π |
- Leo Gutierrez π |
+ Leo Gutierrez π |
Lintsi π |
Linus Fernandes π |
Lixon Lookose π |
Logesh π |
Lorenzo Gabriele π |
LoΓ―c Ledoyen π |
- Lucas Silva π |
+ Lucas Silva π |
Lucas Soncini π» π |
Lukasz Slonina π |
Lukebray π |
Lyor Goldstein π |
MCMicS π |
Macarse π |
- Machine account for PMD π» |
+ Machine account for PMD π» |
Maciek Siemczyk π |
Maikel Steneker π» π |
Maksim Moiseikin π |
Manfred Koch π |
Manuel Moya Ferrer π» π |
Manuel Ryan π |
- Marat Vyshegorodtsev π |
+ Marat Vyshegorodtsev π |
Marcel HΓ€rle π |
Marcello Fialho π |
Marcin Rataj π |
Mark Adamcin π |
Mark Hall π» π |
Mark Kolich π |
- Mark Pritchard π |
+ Mark Pritchard π |
Markus Rathgeb π |
Marquis Wang π |
Martin Feldsztejn π |
Martin Lehmann π |
Martin Spamer π |
Martin TarjΓ‘nyi π |
- MatFl π |
+ MatFl π |
Mateusz Stefanski π |
Mathieu Gouin π |
MatiasComercio π» π |
Matt Benson π |
Matt De Poorter π |
Matt Harrah π |
- Matt Nelson π |
+ Matt Nelson π |
Matthew Amos π |
Matthew Duggan π |
Matthew Hall π |
MatΓas Fraga π» π |
Maxime Robert π» π |
Michael π |
- Michael Bell π |
+ Michael Bell π |
Michael Bernstein π |
Michael Clay π |
Michael Dombrowski π |
Michael Hausegger π |
Michael Hoefer π |
Michael MΓΆbius π |
- Michael N. Lipp π |
+ Michael N. Lipp π |
Michael Pellegrini π |
Michal Kordas π |
MichaΕ Borek π |
MichaΕ KuliΕski π |
Miguel NΓΊΓ±ez DΓaz-Montes π |
Mihai Ionut π |
- Mirek Hankus π |
+ Mirek Hankus π |
Mladjan Gadzic π |
MrAngry52 π |
Muminur Choudhury π |
Mykhailo Palahuta π» π |
Nagendra Kumar Singh π |
Nahuel Barrios π |
- Nathan Braun π |
+ Nathan Braun π |
Nathan Reynolds π |
Nathan Reynolds π |
NathanaΓ«l π |
Nazdravi π |
Neha-Dhonde π |
Nicholas Doyle π |
- Nick Butcher π |
+ Nick Butcher π |
Nico Gallinal π |
Nicola Dal Maso π |
Nicolas Filotto π» |
Nikita Chursin π |
Niklas Baudy π |
Nikolas Havrikov π |
- Nilesh Virkar π |
+ Nilesh Virkar π |
Nimit Patel π |
Niranjan Harpale π |
Noah Sussman π |
Noah0120 π |
Noam Tamim π |
Noel Grandin π |
- Olaf Haalstra π |
+ Olaf Haalstra π |
Oleg Pavlenko π |
Oliver Eikemeier π |
Olivier Parent π» π |
Ollie Abbey π» π |
OverDrone π |
Ozan Gulle π» π |
- PUNEET JAIN π |
+ PUNEET JAIN π |
Parbati Bose π |
Paul Berg π |
Pavel Bludov π |
Pavel MiΔka π |
Pedro Nuno Santos π |
Pedro Rijo π |
- Pelisse Romain π» π π |
+ Pelisse Romain π» π π |
Pete Davids π |
Peter Bruin π |
Peter Chittum π» π |
Peter Cudmore π |
Peter Kasson π |
Peter Kofler π |
- Pham Hai Trung π |
+ Pham Hai Trung π |
Philip Graf π» π |
Philip Hachey π |
Philippe Ozil π |
Phinehas Artemix π |
Phokham Nonava π |
Piotr SzymaΕski π |
- Piotrek Ε»ygieΕo π» π |
+ Piotrek Ε»ygieΕo π» π |
Pranay Jaiswal π |
Prasad Kamath π |
Prasanna π |
Presh-AR π |
Puneet1726 π |
Rafael CortΓͺs π |
- RaheemShaik999 π |
+ RaheemShaik999 π |
RajeshR π» π |
Ramachandra Mohan π |
Raquel Pau π |
Ravikiran Janardhana π |
Reda Benhemmouche π |
Renato Oliveira π» π |
- Rich DiCroce π |
+ Rich DiCroce π |
Riot R1cket π |
Rishabh Jain π |
RishabhDeep Singh π |
Robbie Martinus π» π |
Robert Henry π |
Robert Painsi π |
- Robert Russell π |
+ Robert Russell π |
Robert SΓΆsemann π» π π’ π |
Robert Whitebit π |
Robin Richtsfeld π |
Robin Stocker π» π |
Robin Wils π |
RochusOest π |
- Rodolfo Noviski π |
+ Rodolfo Noviski π |
Rodrigo Casara π |
Rodrigo Fernandes π |
Roman Salvador π» π |
Ronald Blaschke π |
RΓ³bert Papp π |
Saikat Sengupta π |
- Saksham Handu π |
+ Saksham Handu π |
Saladoc π |
Salesforce Bob Lightning π |
Sam Carlberg π |
Satoshi Kubo π |
Scott Kennedy π |
Scott Wells π π» |
- Sebastian BΓΆgl π |
+ Sebastian BΓΆgl π |
Sebastian Schuberth π |
Sebastian Schwarz π |
Sergey Gorbaty π |
Sergey Kozlov π |
Sergey Yanzin π» π |
Shubham π» π |
- Simon Xiao π |
+ Simon Xiao π |
Srinivasan Venkatachalam π |
Stanislav Gromov π |
Stanislav Myachenkov π» |
Stefan Birkner π |
Stefan Bohn π |
Stefan Endrullis π |
- Stefan KlΓΆss-Schuster π |
+ Stefan KlΓΆss-Schuster π |
Stefan Wolf π |
Stephan H. Wissel π |
Stephen π |
Stephen Friedrich π |
Steve Babula π» |
Stexxe π |
- Stian LΓ₯gstad π |
+ Stian LΓ₯gstad π |
StuartClayton5 π |
Supun Arunoda π |
Suren Abrahamyan π |
SwatiBGupta1110 π |
SyedThoufich π |
Szymon Sasin π |
- T-chuangxin π |
+ T-chuangxin π |
TERAI Atsuhiro π |
TIOBE Software π» π |
Taylor Smock π |
Techeira DamiΓ‘n π» π |
Ted Husted π |
TehBakker π |
- The Gitter Badger π |
+ The Gitter Badger π |
Theodoor π |
Thiago Henrique HΓΌpner π |
Thibault Meyer π |
Thomas GΓΌttler π |
Thomas Jones-Low π |
Thomas Smith π» π |
- ThrawnCA π |
+ ThrawnCA π |
Thunderforge π» π |
Tim van der Lippe π |
Tobias Weimer π» π |
Tom Daly π |
Tomer Figenblat π |
Tomi De Lucca π» π |
- Torsten Kleiber π |
+ Torsten Kleiber π |
TrackerSB π |
Ullrich Hafner π |
Utku Cuhadaroglu π» π |
Valentin Brandl π |
Valeria π |
Vasily Anisimov π |
- Vickenty Fesunov π |
+ Vickenty Fesunov π |
Victor NoΓ«l π |
+ Vincent Galloy π» |
Vincent HUYNH π |
Vincent Maurin π |
Vincent Privat π |
Vishhwas π |
- Vitaly π |
- Vitaly Polonetsky π |
+ Vitaly π |
+ Vitaly Polonetsky π |
Vojtech Polivka π |
Vsevolod Zholobov π |
Wang Shidong π |
Waqas Ahmed π |
Wayne J. Earl π |
- Wchenghui π |
- Will Winder π |
+ Wchenghui π |
+ Will Winder π |
William Brockhus π» π |
Wilson Kurniawan π |
Wim Deblauwe π |
Woongsik Choi π |
XenoAmess π» π |
- Yang π» |
- YaroslavTER π |
+ Yang π» |
+ YaroslavTER π |
Young Chan π» π |
YuJin Kim π |
Yuri Dolzhenko π |
Yurii Dubinka π |
Zoltan Farkas π |
- Zustin π |
- aaronhurst-google π |
+ Zustin π |
+ aaronhurst-google π |
alexmodis π |
andreoss π |
andrey81inmd π» π |
anicoara π |
arunprasathav π |
- asiercamara π |
- astillich-igniti π» |
+ asiercamara π |
+ astillich-igniti π» |
avesolovksyy π |
avishvat π |
avivmu π |
axelbarfod1 π |
b-3-n π |
- balbhadra9 π |
- base23de π |
+ balbhadra9 π |
+ base23de π |
bergander π |
berkam π» π |
breizh31 π |
caesarkim π |
carolyujing π |
- cesares-basilico π |
- chrite π |
+ cesares-basilico π |
+ chrite π |
cobratbq π |
coladict π |
cosmoJFH π |
cristalp π |
crunsk π |
- cwholmes π |
- cyberjj999 π |
+ cwholmes π |
+ cyberjj999 π |
cyw3 π |
d1ss0nanz π |
danbrycefairsailcom π |
dariansanity π |
darrenmiliband π |
- davidburstrom π |
- dbirkman-paloalto π |
+ davidburstrom π |
+ dbirkman-paloalto π |
deepak-patra π |
dependabot[bot] π» π |
dinesh150 π |
diziaq π |
dreaminpast123 π |
- duanyanan π |
- dutt-sanjay π |
+ duanyanan π |
+ dutt-sanjay π |
dylanleung π |
dzeigler π |
ekkirala π |
emersonmoura π |
fairy π |
- foxmason π |
- frankegabor π |
+ foxmason π |
+ frankegabor π |
frankl π |
freafrea π |
fsapatin π |
gracia19 π |
guo fei π |
- gurmsc5 π |
- gwilymatgearset π» π |
+ gurmsc5 π |
+ gwilymatgearset π» π |
haigsn π |
hemanshu070 π |
henrik242 π |
hongpuwu π |
hvbtup π» π |
- igniti GmbH π |
- ilovezfs π |
+ igniti GmbH π |
+ ilovezfs π |
itaigilo π |
jakivey32 π |
jbennett2091 π |
jcamerin π |
jkeener1 π |
- jmetertea π |
- johnra2 π» |
+ jmetertea π |
+ johnra2 π» |
josemanuelrolon π» π |
kabroxiko π» π |
karwer π |
kaulonline π |
kdaemonv π |
- kenji21 π» π |
- kfranic π |
+ kenji21 π» π |
+ kfranic π |
khalidkh π |
krzyk π |
lasselindqvist π |
lihuaib π |
lonelyma1021 π |
- lpeddy π |
- lujiefsi π» |
+ lpeddy π |
+ lujiefsi π» |
lyriccoder π |
marcelmore π |
matchbox π |
matthiaskraaz π |
meandonlyme π |
- mikesive π |
- milossesic π |
+ mikesive π |
+ milossesic π |
mriddell95 π |
mrlzh π |
msloan π |
mucharlaravalika π |
mvenneman π |
- nareshl119 π |
- nicolas-harraudeau-sonarsource π |
+ nareshl119 π |
+ nicolas-harraudeau-sonarsource π |
noerremark π |
novsirion π |
oggboy π |
oinume π |
orimarko π» π |
- pallavi agarwal π |
- parksungrin π |
+ pallavi agarwal π |
+ parksungrin π |
patpatpat123 π |
patriksevallius π |
pbrajesh1 π |
phoenix384 π |
piotrszymanski-sc π» |
- plan3d π |
- poojasix π |
+ plan3d π |
+ poojasix π |
prabhushrikant π |
pujitha8783 π |
r-r-a-j π |
raghujayjunk π |
rajeshveera π |
- rajeswarreddy88 π |
- recdevs π |
+ rajeswarreddy88 π |
+ recdevs π |
reudismam π» π |
rijkt π |
rillig-tk π |
rmohan20 π» π |
rxmicro π |
- ryan-gustafson π» π |
- sabi0 π |
+ ryan-gustafson π» π |
+ sabi0 π |
scais π |
sebbASF π |
sergeygorbaty π» |
shilko2013 π |
simeonKondr π |
- snajberk π |
- sniperrifle2004 π |
+ snajberk π |
+ sniperrifle2004 π |
snuyanzin π π» |
sratz π |
stonio π |
sturton π» π |
sudharmohan π |
- suruchidawar π |
- svenfinitiv π |
+ suruchidawar π |
+ svenfinitiv π |
tashiscool π |
test-git-hook π |
testation21 π» π |
thanosa π |
tiandiyixian π |
- tobwoerk π |
- tprouvot π |
+ tobwoerk π |
+ tprouvot π |
trentchilders π |
triandicAnt π |
trishul14 π |
tsui π |
winhkey π |
- witherspore π |
- wjljack π |
+ witherspore π |
+ wjljack π |
wuchiuwong π |
xingsong π |
xioayuge π |
xnYi9wRezm π» π |
xuanuy π |
- xyf0921 π |
- yalechen-cyw3 π |
+ xyf0921 π |
+ yalechen-cyw3 π |
yasuharu-sato π |
zenglian π |
zgrzyt93 π» π |
zh3ng π |
zt_soft π |
- ztt79 π |
- zzzzfeng π |
+ ztt79 π |
+ zzzzfeng π |
ΓrpΓ‘d MagosΓ‘nyi π |
δ»»θ΄΅ζ° π |
diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md
index c194608353..4e81b4e6af 100644
--- a/docs/pages/release_notes.md
+++ b/docs/pages/release_notes.md
@@ -36,6 +36,8 @@ This is a {{ site.pmd.release_type }} release.
* [#3683](https://github.com/pmd/pmd/pull/3683): \[java] Fixed 3468 UnusedPrivateMethod false positive when outer class calls private static method on inner class - [John Armgardt](https://github.com/johnra2)
* [#3688](https://github.com/pmd/pmd/pull/3688): \[java] Bump log4j to 2.16.0 - [Sergey Nuyanzin](https://github.com/snuyanzin)
* [#3693](https://github.com/pmd/pmd/pull/3693): \[apex] ApexDoc: Add reportProperty property - [Steve Babula](https://github.com/babula)
+* [#3713](https://github.com/pmd/pmd/pull/3713): \[java] Enhance UnnecessaryModifier to support records - [Vincent Galloy](https://github.com/vgalloy)
+* [#3719](https://github.com/pmd/pmd/pull/3719): \[java] Upgrade log4j to 2.17.1 - [Daniel Paul Searles](https://github.com/squaresurf)
{% endtocmaker %}
diff --git a/pmd-apex-jorje/pom.xml b/pmd-apex-jorje/pom.xml
index dbfc5b9711..2c732c46dd 100644
--- a/pmd-apex-jorje/pom.xml
+++ b/pmd-apex-jorje/pom.xml
@@ -49,17 +49,17 @@
cglib
cglib
- 3.2.0
+ 3.3.0
ch.qos.logback
logback-classic
- 1.2.3
+ 1.2.9
ch.qos.logback
logback-core
- 1.2.3
+ 1.2.9
com.google.code.findbugs
@@ -69,7 +69,7 @@
com.google.code.gson
gson
- 2.7
+
com.google.errorprone
@@ -79,6 +79,7 @@
com.google.guava
guava
+
com.google.j2objc
@@ -112,12 +113,12 @@
org.slf4j
slf4j-api
- 1.7.20
+
org.yaml
snakeyaml
- 1.26
+
aopalliance
diff --git a/pmd-core/pom.xml b/pmd-core/pom.xml
index 1aa19c3272..0cece6914f 100644
--- a/pmd-core/pom.xml
+++ b/pmd-core/pom.xml
@@ -144,7 +144,6 @@
com.google.code.gson
gson
- 2.8.5
diff --git a/pmd-doc/pom.xml b/pmd-doc/pom.xml
index 005c671b01..525890a786 100644
--- a/pmd-doc/pom.xml
+++ b/pmd-doc/pom.xml
@@ -98,7 +98,6 @@
org.yaml
snakeyaml
- 1.26
diff --git a/pmd-java/pom.xml b/pmd-java/pom.xml
index 1996c27b27..05d7dc05cb 100644
--- a/pmd-java/pom.xml
+++ b/pmd-java/pom.xml
@@ -12,7 +12,7 @@
- 2.17.0
+ 2.17.1
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordDeclaration.java
index f45133d327..238d898e2b 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordDeclaration.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTRecordDeclaration.java
@@ -55,6 +55,10 @@ public final class ASTRecordDeclaration extends AbstractAnyTypeDeclaration {
return isNested() || isLocal();
}
+ public boolean isSyntacticallyFinal() {
+ return super.isFinal();
+ }
+
@Override
public boolean isFinal() {
// A record is implicitly final
diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java
index 1e68bc0ec4..808d89f370 100644
--- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java
+++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/UnnecessaryModifierRule.java
@@ -24,6 +24,7 @@ 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.ASTMethodOrConstructorDeclaration;
+import net.sourceforge.pmd.lang.java.ast.ASTRecordDeclaration;
import net.sourceforge.pmd.lang.java.ast.ASTResource;
import net.sourceforge.pmd.lang.java.ast.AccessNode;
import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil;
@@ -42,6 +43,7 @@ public class UnnecessaryModifierRule extends AbstractJavaRule {
addRuleChainVisit(ASTFieldDeclaration.class);
addRuleChainVisit(ASTAnnotationMethodDeclaration.class);
addRuleChainVisit(ASTConstructorDeclaration.class);
+ addRuleChainVisit(ASTRecordDeclaration.class);
}
@@ -264,6 +266,17 @@ public class UnnecessaryModifierRule extends AbstractJavaRule {
return data;
}
+ @Override
+ public Object visit(ASTRecordDeclaration node, Object data) {
+ if (node.isStatic()) {
+ reportUnnecessaryModifiers(data, node, Modifier.STATIC, "records are implicitly static");
+ }
+ if (node.isSyntacticallyFinal()) {
+ reportUnnecessaryModifiers(data, node, Modifier.FINAL, "records are implicitly final");
+ }
+ return data;
+ }
+
private boolean isSafeVarargs(final ASTMethodDeclaration node) {
return node.isAnnotationPresent(SafeVarargs.class.getName());
diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml
index 4c506e3b9f..cca8c46882 100644
--- a/pmd-java/src/main/resources/category/java/codestyle.xml
+++ b/pmd-java/src/main/resources/category/java/codestyle.xml
@@ -2062,6 +2062,12 @@ public class Bar {
FOO;
}
}
+public class FooClass {
+ static record BarRecord() {} // static ignored
+}
+public interface FooInterface {
+ static record BarRecord() {} // static ignored
+}
]]>
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt
index 6efe275077..6bb71f8b7a 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/LocalRecords.txt
@@ -60,7 +60,7 @@
| | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = false, @ForeachVariable = false, @FormalParameter = true, @Image = "month", @LambdaParameter = false, @LocalVariable = false, @Name = "month", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "month"]
| +- Block[@containsComment = false]
| +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MerchantSales", @Default = false, @Final = true, @Image = "MerchantSales", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MerchantSales", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MerchantSales", @Default = false, @Final = true, @Image = "MerchantSales", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MerchantSales", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| | +- RecordComponentList[@Size = 2]
| | | +- RecordComponent[@Varargs = false]
| | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "Merchant"]
@@ -173,7 +173,7 @@
| | +- FormalParameters[@ParameterCount = 0, @Size = 0]
| +- Block[@containsComment = false]
| +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord1", @Default = false, @Final = true, @Image = "MyRecord1", @Local = true, @Modifiers = 32, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord1", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord1", @Default = false, @Final = true, @Image = "MyRecord1", @Local = true, @Modifiers = 32, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord1", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = true, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| | +- RecordComponentList[@Size = 1]
| | | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
@@ -182,7 +182,7 @@
| | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "a", @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "a"]
| | +- RecordBody[]
| +- BlockStatement[@Allocation = false]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord2", @Default = false, @Final = true, @Image = "MyRecord2", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord2", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord2", @Default = false, @Final = true, @Image = "MyRecord2", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord2", @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = true, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| | +- RecordComponentList[@Size = 1]
| | | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
@@ -194,7 +194,7 @@
| | +- Annotation[@AnnotationName = "Deprecated"]
| | | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
| | | +- Name[@Image = "Deprecated"]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord3", @Default = false, @Final = true, @Image = "MyRecord3", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord3", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord3", @Default = false, @Final = true, @Image = "MyRecord3", @Local = true, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord3", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| | +- RecordComponentList[@Size = 1]
| | | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
@@ -206,7 +206,7 @@
| +- Annotation[@AnnotationName = "Deprecated"]
| | +- MarkerAnnotation[@AnnotationName = "Deprecated"]
| | +- Name[@Image = "Deprecated"]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord4", @Default = false, @Final = true, @Image = "MyRecord4", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord4", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "LocalRecords$MyRecord4", @Default = false, @Final = true, @Image = "MyRecord4", @Local = true, @Modifiers = 48, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyRecord4", @Static = true, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = true, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 1]
| | +- RecordComponent[@Varargs = false]
| | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt
index cdefd5c585..341c9f28da 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt
@@ -1,6 +1,6 @@
+- CompilationUnit[@PackageName = "", @declarationsAreInDefaultPackage = true]
+- TypeDeclaration[]
- +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 1, @Native = false, @Nested = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+- RecordComponentList[@Size = 2]
| +- RecordComponent[@Varargs = false]
| | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt
index 19110e3cb8..dbdbaa18b7 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt
@@ -35,7 +35,7 @@
| +- AnnotationTypeDeclaration[@Abstract = false, @BinaryName = "Records$MyAnnotation", @Default = false, @Final = false, @Image = "MyAnnotation", @Local = false, @Modifiers = 0, @Native = false, @Nested = true, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "MyAnnotation", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.ANNOTATION, @Volatile = false]
| +- AnnotationTypeBody[]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex", @Default = false, @Final = true, @Image = "MyComplex", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "MyComplex", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex", @Default = false, @Final = true, @Image = "MyComplex", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "MyComplex", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 2]
| | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
@@ -113,7 +113,7 @@
| | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| | +- Name[@Image = "imaginary"]
| +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex$Nested", @Default = false, @Final = true, @Image = "Nested", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Nested", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex$Nested", @Default = false, @Final = true, @Image = "Nested", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Nested", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| | +- RecordComponentList[@Size = 1]
| | | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
@@ -124,7 +124,7 @@
| +- ClassOrInterfaceDeclaration[@Abstract = false, @BinaryName = "Records$MyComplex$NestedClass", @Default = false, @Final = false, @Image = "NestedClass", @Interface = false, @Local = false, @Modifiers = 17, @Native = false, @Nested = true, @NonSealed = false, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @Sealed = false, @SimpleName = "NestedClass", @Static = true, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.CLASS, @Volatile = false]
| +- ClassOrInterfaceBody[@AnonymousInnerClass = false, @EnumChild = false]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$Range", @Default = false, @Final = true, @Image = "Range", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Range", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$Range", @Default = false, @Final = true, @Image = "Range", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "Range", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 2]
| | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
@@ -186,7 +186,7 @@
| | +- FormalParameters[@ParameterCount = 0, @Size = 0]
| +- Block[@containsComment = false]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$VarRec", @Default = false, @Final = true, @Image = "VarRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "VarRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$VarRec", @Default = false, @Final = true, @Image = "VarRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "VarRec", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 1]
| | +- RecordComponent[@Varargs = true]
| | +- Annotation[@AnnotationName = "Nullable"]
@@ -204,7 +204,7 @@
| | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"]
| +- RecordBody[]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$ArrayRec", @Default = false, @Final = true, @Image = "ArrayRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "ArrayRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$ArrayRec", @Default = false, @Final = true, @Image = "ArrayRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "ArrayRec", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 1]
| | +- RecordComponent[@Varargs = false]
| | +- Type[@Array = true, @ArrayDepth = 1, @ArrayType = true, @TypeImage = "int"]
@@ -213,7 +213,7 @@
| | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = true, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"]
| +- RecordBody[]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$EmptyRec", @Default = false, @Final = true, @Image = "EmptyRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "EmptyRec", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$EmptyRec", @Default = false, @Final = true, @Image = "EmptyRec", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "EmptyRec", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- TypeParameters[]
| | +- TypeParameter[@Image = "Type", @Name = "Type", @ParameterName = "Type", @TypeBound = false]
| +- RecordComponentList[@Size = 0]
@@ -299,7 +299,7 @@
| +- MethodDeclarator[@Image = "lastName", @ParameterCount = 0]
| +- FormalParameters[@ParameterCount = 0, @Size = 0]
+- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD]
- +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$PersonRecord", @Default = false, @Final = true, @Image = "PersonRecord", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "PersonRecord", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ +- RecordDeclaration[@Abstract = false, @BinaryName = "Records$PersonRecord", @Default = false, @Final = true, @Image = "PersonRecord", @Local = false, @Modifiers = 1, @Native = false, @Nested = true, @PackagePrivate = false, @Private = false, @Protected = false, @Public = true, @SimpleName = "PersonRecord", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+- RecordComponentList[@Size = 2]
| +- RecordComponent[@Varargs = false]
| | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt
index af55a74853..785fc5a864 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17p/EnhancedTypeCheckingSwitch.txt
@@ -180,7 +180,7 @@
| +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false]
| +- Name[@Image = "o"]
+- TypeDeclaration[]
- | +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
+ | +- RecordDeclaration[@Abstract = false, @BinaryName = "Point", @Default = false, @Final = true, @Image = "Point", @Local = false, @Modifiers = 0, @Native = false, @Nested = false, @PackagePrivate = true, @Private = false, @Protected = false, @Public = false, @SimpleName = "Point", @Static = false, @Strictfp = false, @Synchronized = false, @SyntacticallyFinal = false, @Transient = false, @TypeKind = TypeKind.RECORD, @Volatile = false]
| +- RecordComponentList[@Size = 2]
| | +- RecordComponent[@Varargs = false]
| | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "int"]
diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml
index d1d7be5511..8ae474008a 100644
--- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml
+++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/UnnecessaryModifier.xml
@@ -695,6 +695,78 @@ public interface Bar {
void method() {
}
static class Foo {}
+}
+ ]]>
+
+
+
+ Static is not necessary for record declaration in class
+ 1
+
+ Unnecessary modifier 'static' on record 'BarRecord': records are implicitly static
+
+
+
+
+
+ Correct nested record declaration in classes
+ 0
+
+
+
+
+ Static is not necessary for record declaration in interface
+ 1
+
+ Unnecessary modifier 'static' on record 'BarRecord': records are implicitly static
+
+
+
+
+
+ Correct nested record declaration in interface
+ 0
+
+
+
+
+ Final is not necessary for record declaration in class
+ 1
+
+ Unnecessary modifier 'final' on record 'BarRecord': records are implicitly final
+
+
+
+
+
+ Final is not necessary for record declaration in interface
+ 1
+
+ Unnecessary modifier 'final' on record 'BarRecord': records are implicitly final
+
+
diff --git a/pom.xml b/pom.xml
index d0d3c35d2e..6d2b604d31 100644
--- a/pom.xml
+++ b/pom.xml
@@ -712,13 +712,24 @@
org.slf4j
slf4j-api
- 1.7.25
+ 1.7.32
org.codehaus.groovy
groovy
2.4.21
+
+ com.google.code.gson
+ gson
+ 2.8.9
+
+
+ org.yaml
+ snakeyaml
+ 1.30
+
+
@@ -751,8 +762,8 @@
com.google.guava
guava
-
- 30.0-android
+
+ 31.0.1-android
test