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).
>From 2e2518b92d2ed23263ced9d70382c08a934b6964 Mon Sep 17 00:00:00 2001 From: Michael Stahl <mst...@redhat.com> Date: Fri, 18 May 2012 00:50:25 +0200 Subject: [PATCH] codemaker: write version 49 (1.5) class files The trick of writing generic types into class files of versions < 49 does no longer work with javac from OpenJDK 7: /comphelper/qa/complex/comphelper/Map.java:154: error: type Pair does not take parameters Pair< ?, ? >[] initialMappings = new Pair< ?, ? >[ _keys.length ]; --- codemaker/source/javamaker/classfile.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx index 1a8bf01..6ddd8b2 100644 --- a/codemaker/source/javamaker/classfile.cxx +++ b/codemaker/source/javamaker/classfile.cxx @@ -693,7 +693,7 @@ void ClassFile::addMethod( void ClassFile::write(FileStream & file) const { writeU4(file, 0xCAFEBABE); writeU2(file, 0); - writeU2(file, 46); + writeU2(file, 49); // class file version of JRE 1.5 writeU2(file, m_constantPoolCount); writeStream(file, m_constantPool); writeU2(file, static_cast< sal_uInt16 >(m_accessFlags)); -- 1.7.10.2
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice