[Rev 01] RFR: 8241710: NullPointerException while entering empty submenu with "arrow right"

Ajit Ghaisas aghaisas at openjdk.java.net
Tue Apr 7 11:40:21 UTC 2020


On Tue, 7 Apr 2020 10:13:39 GMT, Jeanette Winzenburg <fastegal at openjdk.org> wrote:

>> Ajit Ghaisas has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Minor review fixes
>
> modules/javafx.controls/src/main/java/com/sun/javafx/scene/control/ContextMenuContent.java line 658:
> 
>> 657:             ContextMenuContent cmContent = (ContextMenuContent)submenu.getSkin().getNode();
>> 658:             if (cmContent != null) {
>> 659:                if (cmContent.itemsContainer.getChildren().size() > 0) {
> 
> just a mini-note: personally, I prefer early-return on no-match (vs. wrapping nearly the whole method inside an if match
> 
>     if (submenu == null) return;

I prefer a single point of return for small methods. Anyway, this file has lot of early returns. Hence, I am modifying
as per your suggestion.

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

PR: https://git.openjdk.java.net/jfx/pull/161


More information about the openjfx-dev mailing list