RFR: JDK-8297412: Remove easy warnings in javafx.fxml, javafx.media, javafx.swing, javafx.swt and javafx.web [v3]

John Hendrikx jhendrikx at openjdk.org
Tue Nov 22 19:00:21 UTC 2022


On Tue, 22 Nov 2022 18:30:00 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Revert changes to javafx.web src/main/native
>
> modules/javafx.fxml/src/main/java/javafx/fxml/FXMLLoader.java line 156:
> 
>> 154: 
>> 155:         @SuppressWarnings("unchecked")
>> 156:         public void add(Object element) {
> 
> by removing a checked exception we are changing public API.  do we really want to do that?

This is part of a private class (`class Element`) that's nested within `FXMLLoader`, not public API.

> modules/javafx.fxml/src/main/java/javafx/fxml/FXMLLoader.java line 1494:
> 
>> 1492:         }
>> 1493: 
>> 1494:         @Override
> 
> why removing it from the base class, just to add it back in multiple places?  is this really necessary?

The base method was empty, and it throws `IOException` which triggers a warning.  By making it `abstract` the warning is gone (I could also have documented it).  Since this is an internal private class, it is fine to make it `abstract` instead (the class itself was already `abstract`).  This also means there is no need to call the super implementation since it is now abstract and known to be empty.

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

PR: https://git.openjdk.org/jfx/pull/958


More information about the openjfx-dev mailing list