[REVIEW][3-5] codemaker: write Java 1.5 class files

Michael Stahl mstahl at redhat.com
Fri May 18 08:53:33 PDT 2012


while playing around with Fedora 17 and building master on that
yesterday (instead of spending this public holiday in the manner
traditional in my country, drinking until keeling over), ran into the
following problem:

the javamaker tool, part of URE that generates Java stubs for UNO
interfaces, uses a trick to write class files that work with JREs from
version 1.2 onwards, but still contain generic types (which are only
officially supported in JRE 1.5) for polymorphic UNO structs: it simply
writes the generic type parameters into the class files, but sets the
version field of the class file corresponding to Java 1.2.

this unfortunately fails now with OpenJDK 1.7: javac in that version
deliberately ignores the type parameters in class files of versions
older than 49, which breaks the build:

http://pastebin.com/ptEFU9AP (somebody else ran into this weeks ago)

there appears to be a related JRE bug for this, at some time javac had
an undocumented option to produce similar class files that are also
rejected now, this has been closed as "Not a Defect":

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7078419

now of course the test code could be changed to remove the generics
etc., so it is not such a big problem, but i'm afraid this will also
really annoy extension authors that use Java; they will first have to
understand the problem (which is not really obvious), and then have to
choose between using older JDK to develop or adapting their code to
remove generics usage.

for this reason i'm in favor of immediately dropping support for
anything older than Java 1.5 on master, and also on libreoffice-3-5.
(i don't actually know what our "official" Java baseline is, perhaps it
is already 1.5?)

this page says that Java 1.4 was EOL in 2008(!), so i don't see much
sense in continuing to support it in any case:

http://www.oracle.com/technetwork/java/eol-135779.html

the attached (uncommitted) patch changes codemaker to produce class
files in version 49, supported by JREs 1.5 or later, effectively raising
the baseline to Java 1.5 (if it is not there already).


More information about the LibreOffice mailing list