[ https://issues.apache.org/jira/browse/PDFBOX-5362?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Lehmkühler resolved PDFBOX-5362. ---------------------------------------- Fix Version/s: 3.0.0 PDFBox Resolution: Not A Problem [~rototor] Thanks for the effort, but fortunately your patch isn't necessary any more > [PATCH] Replace finalize() with Cleaner > --------------------------------------- > > Key: PDFBOX-5362 > URL: https://issues.apache.org/jira/browse/PDFBOX-5362 > Project: PDFBox > Issue Type: Improvement > Components: FontBox, IO > Affects Versions: 3.0.0 PDFBox > Reporter: Emmeran Seehuber > Assignee: Andreas Lehmkühler > Priority: Major > Fix For: 3.0.0 PDFBox > > Attachments: replace_finalizer_with_cleaner_v1.patch > > > Finalizers (method finalize()) are going to be deprecated for removal with > JDK 18. See [https://openjdk.java.net/jeps/421] for details. > The best way to replace the finalize() methods is by using the JDK 9 > java.lang.ref.Cleaner. As PDFBox 3 targets JDK 8 this can not be used > directly. > The attached patch implements a Cleaner using finalizers for JDK <= 8 and > using java.lang.ref.Cleaner by reflection for JDK 9+. > The two remaining finalize() implementing classes are migrated to the new > Cleaner. > I’m not really happy with the name and package > org.apache.fontbox.util.PdfBoxInternalCleaner of the cleaner. Maybe you have > an idea for a better place and name. > In theory this patch could be back ported to PDFBox 2, but I’m not sure if > this is worth the risk. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@pdfbox.apache.org For additional commands, e-mail: dev-h...@pdfbox.apache.org