Skip to content

MemoryClassLoader: resolve a Java 20 deprecation warning about constructor java.net.URL#20

Open
dilyanpalauzov wants to merge 1 commit intoeobermuhlner:masterfrom
dilyanpalauzov:url_ctor_deprecation
Open

MemoryClassLoader: resolve a Java 20 deprecation warning about constructor java.net.URL#20
dilyanpalauzov wants to merge 1 commit intoeobermuhlner:masterfrom
dilyanpalauzov:url_ctor_deprecation

Conversation

@dilyanpalauzov
Copy link

[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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant