It has nothing to do with the language but with the API / VM capabilities.
Both those restrictions are fixed, granted that this is not yet in the offical API, it's an incubation module (the equivalent of from __future__ of Python).
https://docs.oracle.com/en/java/javase/17/docs/api/jdk.incub...