RFR: JDK-8304959: Public API in javafx.css.Match should not return private API class PseudoClassState [v7]

John Hendrikx jhendrikx at openjdk.org
Wed May 17 22:00:00 UTC 2023


On Wed, 17 May 2023 21:12:48 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Override hashCode with a comment explaining why
>>  - Fix style issues
>>  - Restore removed public method
>
> modules/javafx.graphics/src/main/java/com/sun/javafx/css/BitSet.java line 233:
> 
>> 231:     @Override
>> 232:     public boolean containsAll(Collection<?> c) {
>> 233:         if (this.getClass() != c.getClass()) {
> 
> this change is not equivalent: in the old code, null `c` would return false, in the new it'll throw an NPE

That's correct, before it broke the contract of `Set`.  It's not supposed to return `false` when the parameter is `null`.  This class is sometimes exposed as public API (via `ObservableSet`) and so must respect the `Set` contract.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1070#discussion_r1197092382


More information about the openjfx-dev mailing list