Hi,

I am developing a software that relies heavily on Apache PdfBox. It uses the 
current the current PDFBox 3.0.0 from trunk, with some patches.

I wanted to know what your thoughts are about raising the minimum Java version 
for PDFBox 3.x to Java 11. I know some might say "we are still on JDK 8 and 
will be for the foreseeable future“. But then you could probably stay on the 
2.x line of PDFBox, since you won’t be able to update most of your technology 
stack to recent versions anyway:

 - Spring BOOT 3 requires Java 17
 - WildFly 27 dropped support for Java 8, and while I don’t have access to the 
Redhat docs, I think so will JBOSS 8
 - Hibernate 6 requires at least Java 11
 - Apache Tomcat 6 requires at least Java 11, 6.1 even requires 17
 - Apache Lucene 9.5 requires Java 11

IMHO, the next major version a.k.a. PDFBox 3.0.0 would be the right moment to 
increase the required Java version.

- PDFBox uses classes and methods that are deprecated in newer Java versions.
- IMHO it will also be harder to get contributors.
- Some things have to be done in a cumbersome and less performant way to 
maintain Java 8 compatibility because functionality introduced in newer JDKs 
cannot be used to keep Java 8 compatibility:
    Java 8 (current implementation):
    public static byte[] toByteArray(InputStream in) throws IOException
    {
        ByteArrayOutputStream baout = new ByteArrayOutputStream();
        copy(in, baout);
        return baout.toByteArray();
    }
    public static long copy(InputStream input, OutputStream output) throws 
IOException
    {
        byte[] buffer = new byte[4096];
        long count = 0;
        int n = 0;
        while (-1 != (n = input.read(buffer)))
        {
            output.write(buffer, 0, n);
            count += n;
        }
        return count;
    }
    Java 11:
    public static byte[] toByteArray(InputStream in) throws IOException {
        return in.readAllBytes();
    }
    public static long copy(InputStream input, OutputStream output) throws 
IOException {
        return input.transferTo(output);
    }

I would like to contribute to PDFBox, but would really suggest to bump the 
required Java version to Java 11. I personally would be OK with going directly 
to 17 like Spring framework did, but I can see that Java 11 compatibility might 
be a serious issue for some.

What are your thoughts on this matter?

Axel

Reply via email to