<div dir="ltr">Sorry to put this message in another thread, I have just subscribed to jdk-dev so dont have the initial thread in the box.<div><br></div><div>In this mail I would love to ask/propose to emit more verbose compile-time warnings when compiled code uses deprecated Unsafe methods with suggestions to replace it with corresponding alternatives in new APIs.</div><div> </div><div>I am myself guilty of using private APIs and Unsafe particular in projects for various reasons, but to be fair, I am not really familiar with most of the low-level APIs. I think it's fairly common when people just find some code snippet in a public repo or stackoverflow, paste it, see that it works and proceed with the project. This people could find themself disoriented when after updating to new Java version, Unsafe methods are just gone (or does not compile). I am aware that in JEP alternatives for most if not all replacements are described, but I think we all know that not every Java developer keeps an eye on Java world updates to know where to look for reliable information about intended substitutions.</div><div><br></div><div>As for now, If I understood everything correctly, warnings are only emitted at runtime and do not contain any particular information on where and what has been called exactly. Imo, this noninformative message does not carry any particular info for people that write code using Unsafe and do not help or encourage migrating to new APIs.</div><div><br></div><div>Best regards</div><div><br></div><div>PS: just checked the current state of things for a few methods, and deprecation messages in Unsafe do not provide direct alternatives to deprecated methods, just suggestions to migrate to xHandle classes or other parts of new APIs.</div></div>