Branch: refs/heads/main
  Home:   https://github.com/pmd/pmd
  Commit: 5c9271c586d69d4386f14a2f997f9d4ff56a0a75
      https://github.com/pmd/pmd/commit/5c9271c586d69d4386f14a2f997f9d4ff56a0a75
  Author: Yuriy Tumanov <[email protected]>
  Date:   2026-09-30 (Wed, 30 Sep 2026)

  Changed paths:
    M docs/pages/release_notes.md
    M 
pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/design/ExceptionAsFlowControlRule.java
    M 
pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ExceptionAsFlowControl.xml

  Log Message:
  -----------
  [java] ExceptionAsFlowControl: a throw in a lambda invoked by the method it 
is passed to (#7118)

* [java] ExceptionAsFlowControl: a throw in a lambda invoked by the method it 
is passed to

#7105 stopped the walk at every lambda body. That fixed the false positive of
#4815, but it also stopped reporting a throw inside a lambda that the method it
is passed to calls itself. spring-framework's
LeakAwareNettyDataBufferFactory#checkForLeaks (v5.3.13, line 56) throws inside
Iterable.forEach and catches the exception right below.

The walk now continues through a lambda that is an argument of a call whose
method calls that argument: Iterable.forEach, Iterator.forEachRemaining,
Map.forEach, Optional.ifPresent/ifPresentOrElse, and the Stream methods that
take a lambda argument. A terminal operation calls the action while the call is
evaluated; an intermediate operation is evaluated by the terminal operation of
the same pipeline. Every other lambda stays opaque, so #4815 does not come back.

Signed-off-by: Eljees <[email protected]>

* Use compound invocation matcher and clarify release notes

* [java] Handle primitive streams in ExceptionAsFlowControl

---------

Signed-off-by: Eljees <[email protected]>



To unsubscribe from these emails, change your notification settings at 
https://github.com/pmd/pmd/settings/notifications


_______________________________________________
Pmd-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pmd-commits

Reply via email to