[PATCH] codemaker: write version 49 (1.5) class files

Michael Stahl mstahl at redhat.com
Thu May 17 15:50:25 PDT 2012


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


--------------070600030903010100050003--



More information about the LibreOffice mailing list