ImageWorker "illegal reflective access" with Java 11++
Description
following warnings are shown if ImageWorker instance is created:
WARNING:An illegal reflective access operation has occurred
WARNING:Illegal reflective access by org.geotools.image.ImageWorker(file:/[..]target/p2-local-target/plugins/org.locationtech.udig.libs_2.3.0.qualifier/lib/gt-coverage-22.1.jar)toconstructorcom.sun.imageio.plugins.jpeg.JPEGImageWriterSpi()WARNING:Please consider reporting thistothe maintainers of org.geotools.image.ImageWorkerWARNING:Use--illegal-access=warn toenable warnings of further illegal reflective access operations
WARNING:All illegal access operations will be denied in a future release
the cause are the five constructs (at the time of writing) such as follows:
following warnings are shown if ImageWorker instance is created:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by org.geotools.image.ImageWorker (file:/[..]target/p2-local-target/plugins/org.locationtech.udig.libs_2.3.0.qualifier/lib/gt-coverage-22.1.jar) to constructor com.sun.imageio.plugins.jpeg.JPEGImageWriterSpi() WARNING: Please consider reporting this to the maintainers of org.geotools.image.ImageWorker WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations WARNING: All illegal access operations will be denied in a future release
the cause are the five constructs (at the time of writing) such as follows:
Class<?> clazz = Class.forName("com.sun.media.imageioimpl.plugins.gif.GIFImageWriterSpi"); if (clazz != null) { temp = (ImageWriterSpi) clazz.getDeclaredConstructor().newInstance(); } else { temp = null; }
I assume since these are extensions the SPI-Mechanism should be used rather creating instances of classes by ImageWorker itself.