RFR: 8267521: Post JEP 411 refactoring: maximum covering > 50K [v3]

Phil Race prr at openjdk.java.net
Fri May 28 03:15:12 UTC 2021

On Fri, 28 May 2021 02:50:55 GMT, Weijun Wang <weijun at openjdk.org> wrote:

>> src/java.desktop/share/classes/java/awt/Component.java line 630:
>>> 628:         }
>>> 629: 
>>> 630:         @SuppressWarnings("removal")
>> I'm confused. I thought the reason this wasn't done in the JEP implementation PR is because of refactoring
>> that was needed because of the usage in this static block and you could not apply the annotation here.
>> Yet it seems you are doing exactly what was supposed to be impossible with no refactoring.
>> Can you explain ?
> There *is* a tiny refactoring here: a new variable `s2` is introduced so the 2nd `doPrivileged` call on line 636 is now also in a declaration statement (for `s2`) and therefore annotatable. Without this I cannot add the annotation on line 635.

Ok. But I will quote you
"This happens when a deprecated method is called inside a static block. The annotation can only be added to a declaration and here it must be the whole class"

So the way you explained this before made it sound like any time there was any SM API usage in a static block, the entire class needed to be annotated.

Why has the explanation changed ?


PR: https://git.openjdk.java.net/jdk/pull/4138

More information about the net-dev mailing list