From 4e4dec8630e67f717c0fb968435cd5e1d85d9965 Mon Sep 17 00:00:00 2001
From: Herbert Dürr <hdu@apache.org>
Date: Mon, 25 Feb 2013 07:53:56 +0000
Subject: #i121098# use a classfile format compatible with at least JDK 5/6/7

According to http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7078419
JDK 7 and up will never support classfile formats 48 or earlier because
they lack generic signature attributes. Our current baseline is JDK 5
anyway which has the classfile format 49
(see e.g. http://en.wikipedia.org/wiki/Java_class_file or the JVM spec)

Suggested by: Pedro Giffuni <pfg@apache.org>
---
 codemaker/source/javamaker/classfile.cxx | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

(limited to 'codemaker')

diff --git a/codemaker/source/javamaker/classfile.cxx b/codemaker/source/javamaker/classfile.cxx
index f824eb25f5eb..1f154c775fd3 100644
--- a/codemaker/source/javamaker/classfile.cxx
+++ b/codemaker/source/javamaker/classfile.cxx
@@ -692,10 +692,12 @@ void ClassFile::addMethod(
     appendSignatureAttribute(m_methods, signature);
 }
 
+#define CLASSFILE_FMT 49.0 // a classfile format understood by JDK 5/6/7
+
 void ClassFile::write(FileStream & file) const {
     writeU4(file, 0xCAFEBABE);
-    writeU2(file, 0);
-    writeU2(file, 46);
+    writeU2(file, static_cast<sal_uInt16>((CLASSFILE_FMT-(int)CLASSFILE_FMT)*100000));
+    writeU2(file, static_cast<sal_uInt16>((int)CLASSFILE_FMT));
     writeU2(file, m_constantPoolCount);
     writeStream(file, m_constantPool);
     writeU2(file, static_cast< sal_uInt16 >(m_accessFlags));
-- 
cgit