On Tue, 3 Sep 2024 08:47:20 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> Deprecation annotations and warnings on starting the tool(s).
>> Handle man page in a separate issue.
>
> src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HotSpotAgent.java line 
> 207:
> 
>> 205:       to which the RMI connector is bound. If not specified a random
>> 206:       available port is used. */
>> 207:     @Deprecated(since="24", forRemoval=true)
> 
> jdk.agent.agent does not export any APIs so I assume it's pointless adding 
> the `@Deprecated` to the classes. For tools like this, the important bit is 
> the warning at startup (like we did with other tools).

Maybe we can call these tags pointless.  But they do give a useful check that 
our own code (which should be limited to the tool being deprecated here) has to 
be aware of and suppress the deprecation.

Also if anybody does have e.g. class MyTool extends DebugServer and was 
building with something like:

bash-4.2$ javac --add-modules jdk.hotspot.agent --add-exports 
jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED MyTool.java        

..then that was building with no error, but now gets a Warning:

bash-4.2$ build/linux-x64/images/jdk/bin/javac --add-modules jdk.hotspot.agent 
--add-exports jdk.hotspot.agent/sun.jvm.hotspot=ALL-UNNAMED MyTool.java         
                                                                                
               
MyTool.java:3: warning: [removal] DebugServer in sun.jvm.hotspot has been 
deprecated and marked for removal
public class MyTool extends DebugServer {
                            ^
1 warning


..so they do offer some safeguard.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20830#discussion_r1741782647

Reply via email to