Is it possible to avoid Illegal reflective access operation warning with iText PDF FontFactory.registerDirectories() and Java 11?
Steps for reproducing the problem:
- Install
OpenJDK 11. - Add
iText PDFlibraryv5.5.13.2to your Java project. - Call
com.itextpdf.text.FontFactory.registerDirectories(). - See the warning:
WARNING: An illegal reflective access operation has occurred WARNING: Illegal reflective access by com.itextpdf.text.io.ByteBufferRandomAccessSource$1 to method java.nio.DirectByteBuffer.cleaner() WARNING: Please consider reporting this to the maintainers of com.itextpdf.text.io.ByteBufferRandomAccessSource$1 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
See the poc with Java 11 & Gradle here.