java-scriptengine
java-scriptengine copied to clipboard
MemoryClassLoader: resolve a Java 20 deprecation warning about constructor java.net.URL
[WARNING] java/ch/obermuhlner/scriptengine/java/MemoryClassLoader.java:[43,27] The constructor java.net.URL(java.lang.String) is deprecated since version 20
This is supposed to be Java 8 compatible: The exception-pipe syntax is valid since Java 7 - https://docs.oracle.com/javase/7/docs/technotes/guides/language/catch-multiple.html, this works:
$ javac --source 8 --target 8 ch.obermuhlner.scriptengine.java/src/main/java/ch/obermuhlner/scriptengine/java/MemoryClassLoader.java
warning: [options] bootstrap class path not set in conjunction with -source 8
warning: [options] source value 8 is obsolete and will be removed in a future release
warning: [options] target value 8 is obsolete and will be removed in a future release
warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
4 warnings
and URI.toURL() is part of Java 8 - https://docs.oracle.com/javase/8/docs/api/java/net/URI.html#toURL .