diff --git a/.all-contributorsrc b/.all-contributorsrc index 0666f3e975..ce485028d8 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -7135,6 +7135,16 @@ "contributions": [ "code" ] + }, + { + "login": "mohui1999", + "name": "Seren", + "avatar_url": "https://avatars.githubusercontent.com/u/46819179?v=4", + "profile": "https://github.com/mohui1999", + "contributions": [ + "bug", + "code" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 32b6eacc60..7c364b7d02 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -656,363 +656,364 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ› +
Seren

๐Ÿ› ๐Ÿ’ป
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ› -
Seth Wilcox

๐Ÿ’ป +
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป ๐Ÿ›
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป -
Stefan Birkner

๐Ÿ› +
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ› -
Stephen Friedrich

๐Ÿ› +
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Steven Stearns

๐Ÿ› ๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ› -
Suren Abrahamyan

๐Ÿ› +
Suren Abrahamyan

๐Ÿ›
Suvashri

๐Ÿ“–
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ›
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ› -
TIOBE Software

๐Ÿ’ป ๐Ÿ› +
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Tarush Singh

๐Ÿ’ป
Taylor Smock

๐Ÿ›
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ›
The Gitter Badger

๐Ÿ› -
Theodoor

๐Ÿ› +
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ›
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ›
ThrawnCA

๐Ÿ› -
Thunderforge

๐Ÿ’ป ๐Ÿ› +
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ›
Tom Copeland

๐Ÿ› ๐Ÿ’ป ๐Ÿ“–
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ› -
Torsten Kleiber

๐Ÿ› +
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Tyson Stewart

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ›
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ› -
Valery Yatsynovich

๐Ÿ“– +
Valery Yatsynovich

๐Ÿ“–
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป
Vincent HUYNH

๐Ÿ› -
Vincent Maurin

๐Ÿ› +
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ›
Vsevolod Zholobov

๐Ÿ› -
Vyom Yadav

๐Ÿ’ป +
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ›
William Brockhus

๐Ÿ’ป ๐Ÿ› -
Wilson Kurniawan

๐Ÿ› +
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ›
Yasar Shaikh

๐Ÿ’ป -
Young Chan

๐Ÿ’ป ๐Ÿ› +
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป -
alexmodis

๐Ÿ› +
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป -
avesolovksyy

๐Ÿ› +
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ›
base23de

๐Ÿ› -
bergander

๐Ÿ› +
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cbfiddle

๐Ÿ›
cesares-basilico

๐Ÿ› -
chrite

๐Ÿ› +
chrite

๐Ÿ›
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ›
crunsk

๐Ÿ›
cwholmes

๐Ÿ› -
cyberjj999

๐Ÿ› +
cyberjj999

๐Ÿ›
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dague1

๐Ÿ“–
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ› -
darrenmiliband

๐Ÿ› +
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ›
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ› -
dreaminpast123

๐Ÿ› +
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ›
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ› -
fairy

๐Ÿ› +
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ› -
gracia19

๐Ÿ› +
gracia19

๐Ÿ›
guo fei

๐Ÿ›
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ› -
hongpuwu

๐Ÿ› +
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ›
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ› -
jcamerin

๐Ÿ› +
jcamerin

๐Ÿ›
jkeener1

๐Ÿ›
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ› -
kaulonline

๐Ÿ› +
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ›
kdebski85

๐Ÿ› ๐Ÿ’ป
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
koalalam

๐Ÿ› -
krzyk

๐Ÿ› +
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ›
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป -
lukelukes

๐Ÿ’ป +
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ›
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ› -
milossesic

๐Ÿ› +
milossesic

๐Ÿ›
mluckam

๐Ÿ’ป
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ› -
mvenneman

๐Ÿ› +
mvenneman

๐Ÿ›
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ› -
orimarko

๐Ÿ’ป ๐Ÿ› +
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ› -
phoenix384

๐Ÿ› +
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ› -
raghujayjunk

๐Ÿ› +
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ› -
rmohan20

๐Ÿ’ป ๐Ÿ› +
rmohan20

๐Ÿ’ป ๐Ÿ›
rnveach

๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ›
sebbASF

๐Ÿ› -
sergeygorbaty

๐Ÿ’ป +
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป -
sratz

๐Ÿ› +
sratz

๐Ÿ›
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ› -
test-git-hook

๐Ÿ› +
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ› -
triandicAnt

๐Ÿ› +
triandicAnt

๐Ÿ›
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ› -
xingsong

๐Ÿ› +
xingsong

๐Ÿ›
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ› -
zenglian

๐Ÿ› +
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

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

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

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

๐Ÿ›
่Œ…ๅปถๅฎ‰

๐Ÿ’ป diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 65ee53748d..b875222f4d 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -42,6 +42,8 @@ The remaining section describe the complete release notes for 7.0.0. Fixed Issues: * java-codestyle * [#4273](https://github.com/pmd/pmd/issues/4273): \[java] CommentDefaultAccessModifier ignoredAnnotations should include "org.junit.jupiter.api.extension.RegisterExtension" by default +* java-errorprone + * [#4449](https://github.com/pmd/pmd/issues/4449): \[java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression ### ๐Ÿš€ Major Features and Enhancements @@ -364,6 +366,7 @@ Language specific fixes: * [#3351](https://github.com/pmd/pmd/issues/3351): \[java] ConstructorCallsOverridableMethod ignores abstract methods * [#3400](https://github.com/pmd/pmd/issues/3400): \[java] AvoidUsingOctalValues FN with underscores * [#4356](https://github.com/pmd/pmd/pull/4356): \[java] Fix NPE in CloseResourceRule + * [#4449](https://github.com/pmd/pmd/issues/4449): \[java] AvoidAccessibilityAlteration: Possible false positive in AvoidAccessibilityAlteration rule when using Lambda expression * java-multithreading * [#2537](https://github.com/pmd/pmd/issues/2537): \[java] DontCallThreadRun can't detect the case that call run() in `this.run()` * [#2538](https://github.com/pmd/pmd/issues/2538): \[java] DontCallThreadRun can't detect the case that call run() in `foo.bar.run()` @@ -395,6 +398,7 @@ Language specific fixes: * [#4412](https://github.com/pmd/pmd/pull/4412): \[doc] Added new error msg to ConstantsInInterface - [David Ljunggren](https://github.com/dague1) (@dague1) * [#4428](https://github.com/pmd/pmd/pull/4428): \[apex] ApexBadCrypto bug fix for #4427 - inline detection of hard coded values - [Steven Stearns](https://github.com/sfdcsteve) (@sfdcsteve) * [#4444](https://github.com/pmd/pmd/pull/4444): \[java] CommentDefaultAccessModifier - ignore org.junit.jupiter.api.extension.RegisterExtension by default - [Nirvik Patel](https://github.com/nirvikpatel) (@nirvikpatel) +* [#4450](https://github.com/pmd/pmd/pull/4450): \[java] Fix #4449 AvoidAccessibilityAlteration: Correctly handle Lambda expressions in PrivilegedAction scenarios - [Seren](https://github.com/mohui1999) (@mohui1999) ### ๐Ÿ“ˆ Stats * 4416 commits diff --git a/pmd-java/src/main/resources/category/java/errorprone.xml b/pmd-java/src/main/resources/category/java/errorprone.xml index c141a2eb81..c888a021ff 100644 --- a/pmd-java/src/main/resources/category/java/errorprone.xml +++ b/pmd-java/src/main/resources/category/java/errorprone.xml @@ -87,6 +87,8 @@ suppression methods (e.g. by using `@SuppressWarnings` annotation). [not(ancestor::ConstructorCall[1][pmd-java:typeIs('java.security.PrivilegedAction')]/AnonymousClassDeclaration)] (: exclude inner privileged action classes :) [not(ancestor::ClassOrInterfaceDeclaration[1][pmd-java:typeIs('java.security.PrivilegedAction')])] + (: exclude privileged action lambdas :) + [not(ancestor::LambdaExpression[pmd-java:typeIs('java.security.PrivilegedAction')])] ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidAccessibilityAlteration.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidAccessibilityAlteration.xml index b20329d34b..3e650c070c 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidAccessibilityAlteration.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/AvoidAccessibilityAlteration.xml @@ -184,4 +184,39 @@ public class Violation { } ]]> - \ No newline at end of file + + + #4449 setAccessible is ok in LambdaExpression + 0 + constructor = this.getClass().getDeclaredConstructor(String.class); + + // deliberate accessibility alteration + String privateField = AccessController.doPrivileged((PrivilegedAction)() -> { + try { + Field field = Violation.class.getDeclaredField("aPrivateField"); + field.setAccessible(true); //no violation + return (String) field.get(null); + } catch (ReflectiveOperationException | SecurityException e) { + throw new RuntimeException(e); + } + }); + } + } + + ]]> + + + + +