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 ];

There appears to be a related JDK 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

Change-Id: I8a504f6cbb3bb58cd914aebb88637cc6feb0bd48
This commit is contained in:
Michael Stahl 2012-05-18 00:50:25 +02:00
parent e81f027954
commit 26643fb59e

View file

@ -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));