On Fri, 9 May 2025 19:18:58 GMT, Daniel Fuchs <dfu...@openjdk.org> wrote:

>> src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java 
>> line 214:
>> 
>>> 212:      */
>>> 213:     @Override
>>> 214:     @Deprecated(since = "25", forRemoval = true)
>> 
>> Is this annotation required or more as a reminder that the superclass method 
>> is deprecated?
>
> I think it's needed because the superclass method is deprecated for removal. 
> Will double check.

Yes - it is needed. If you override a deprecated method you need to carry the 
deprecation annotation over. Here is what I got when I tried to remove the 
annotation on `HttpURLConnection::getPermission()` (the same error occurred on 
any subclass where I attempted to remove the annotation):

java/net/HttpURLConnection.java:615: warning: [dep-ann] deprecated item is not 
annotated with @Deprecated
    public Permission getPermission() throws IOException {
                      ^
error: warnings found and -Werror specified

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

PR Review Comment: https://git.openjdk.org/jdk/pull/24592#discussion_r2084915172

Reply via email to