RFR: 8290310: ChangeListener events are incorrect or misleading when a nested change occurs [v16]

John Hendrikx jhendrikx at openjdk.org
Sun Jun 8 09:15:04 UTC 2025


On Sat, 7 Jun 2025 20:12:10 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with two additional commits since the last revision:
>> 
>>  - Change StackOverflowException to warning log
>>  - Support keeping last message in Logging helper
>
> modules/javafx.base/src/test/java/test/javafx/beans/ObservableValueTest.java line 126:
> 
>> 124: 
>> 125:             action.removeListener(obs -> {});
>> 126:             action.removeListener((obs, old, current) -> {});
> 
> These can use the unnamed variables pattern `_`. Also in other places.

I think that just hurts readability.  This makes it clear that one is a dummy invalidation listener and the other is a dummy change listener.  I think that even goes for almost all uses of `_` except maybe for deconstruction patterns (as the record name is still mentioned then).  The extra variable name(s) help(s) to see which kind of lambda it is.

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1081#discussion_r2134558373


More information about the openjfx-dev mailing list