Until now this is not possible. At least not something that you think of, like a clean If/else
condition. If we hack deep enough we can make it happen, in a very dirty way though.
That's the reason that methods get deprecated. They don't throw things out of the window so that the project must be compiled with another method. They provide for enough time those deprecated methods so that you can move forward safely.
That is also the case in your question. Your project could compile with either JDK 13 or JDK 15 using the same code.
com.sun.management.OperatingSystemMXBean bean = (com.sun.management.OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
bean.getFreePhysicalMemorySize();
bean.getTotalPhysicalMemorySize();
bean.getSystemCpuLoad();
This code will be able to compile and function from JDK 11 up to all new versions of JDK. If you switch to JDK 14 though, you will receive a deprecated warning.

Considering that JDK 11 is a LTS version, they could not throw methods out of the window. Most probably they will be available also to the next LTS version.