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

Environment

None

Activity

Andrea Aime 
March 20, 2022 at 6:20 PM

Code is not using reflection any longer, but doing a reader lookup in the IOORegistry. See linked issue.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Affects versions

Priority

Created August 27, 2021 at 5:50 AM
Updated March 20, 2022 at 6:20 PM
Resolved March 20, 2022 at 6:20 PM