[QFJ-327] Compiling the source under jdk 1.5.x; inconvertible types Created: 05/Aug/08  Updated: 08/Sep/08  Resolved: 08/Sep/08

Status: Closed
Project: QuickFIX/J
Component/s: Build
Affects Version/s: 1.3.1
Fix Version/s: None

Type: Other Priority: Default
Reporter: Thomas Hügel Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None


 Description   

Just tried to compile the source with "ant jar" under jdk 1.5.x because the new release 1.3.2 seems to be compiled wiht a newer version ("Bad version number in .class File").

I got the following:
--------------------------------------------------------
compile_main:
[javac] Compiling 1431 source files to /private/tmp/qfixsrc/quickfixj/core/target/classes/main
[javac] /private/tmp/qfixsrc/quickfixj/core/src/main/java/quickfix/FieldMap.java:211: inconvertible types
[javac] found : quickfix.Field<capture of ?>
[javac] required: quickfix.StringField
[javac] StringField f = (StringField) fields.get(field);
[javac] ^
[javac] /private/tmp/qfixsrc/quickfixj/core/src/main/java/quickfix/FieldMap.java:358: inconvertible types
[javac] found : quickfix.Field<capture of ?>
[javac] required: quickfix.BytesField
[javac] else if (!(returnField instanceof BytesField))
[javac] ^
[javac] /private/tmp/qfixsrc/quickfixj/core/src/main/java/quickfix/FieldMap.java:362: inconvertible types
[javac] found : quickfix.Field<capture of ?>
[javac] required: quickfix.BytesField
[javac] return (BytesField) returnField;
[javac] ^
[javac] /private/tmp/qfixsrc/quickfixj/core/src/main/java/quickfix/DataDictionary.java:589: inconvertible types
[javac] found : quickfix.Field<capture of ?>
[javac] required: quickfix.StringField
[javac] StringField field = (StringField) iterator.next();
[javac] ^
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.
[javac] 4 errors

BUILD FAILED
/private/tmp/qfixsrc/quickfixj/build.xml:36: The following error occurred while executing this line:
/private/tmp/qfixsrc/quickfixj/build.xml:27: The following error occurred while executing this line:
/private/tmp/qfixsrc/quickfixj/core/build.xml:80: The following error occurred while executing this line:
/private/tmp/qfixsrc/quickfixj/core/build.xml:85: The following error occurred while executing this line:
/private/tmp/qfixsrc/quickfixj/core/build.xml:104: Compile failed; see the compiler error output for details.

--------------------------------------------------------

Do you have any suggestions how to solve the problem ?.

Thanks
Thomas



 Comments   
Comment by Steve Bate [ 06/Aug/08 ]

Are you using the newest version of JDK 1.5? There are some generics-related bugs in early versions of the compiler.

There are special JDK1.4 binary packages if that's what you need. The source must be compiled with Java 5+.

Comment by Toli Kuznets [ 07/Aug/08 ]

Thomas,

It compiles for me with java version "1.5.0_13"

if i remember correctly, you need to have Java version higher than 1.5.0_06 - there was a bug in compilation of generics in _06 so you need to get a compiler higher than that.

Here's the output of my java -version call:
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_13-b05-237)
Java HotSpot(TM) Client VM (build 1.5.0_13-119, mixed mode, sharing)

Comment by Thomas Hügel [ 07/Aug/08 ]

Thanks for the response. I tried with 1.5.0_06 then with 1.5.0_07 - failed; then I downloaded the last 1.5 sdk Version "1.5.0_16". This one was able to compile the source.

Comment by Christoph John [ 25/Aug/08 ]

Hi,

I am not even trying to compile the source but when I start my process which uses QuickFIX/J 1.3.2 then I also get:

Exception in thread "main" java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)

I have JDK 1.5.0_16. When using JDK1.6.0_07 the error does not occur.

Any thoughts?
Best regards,
Chris

Comment by Steve Bate [ 25/Aug/08 ]

It's possible the code was accidentally compiled with Java 6 instead of Java 5. I'll check into it. Thanks for the report. I'm surprised no one else has reported this issue.

Generated at Sat Nov 23 07:46:03 UTC 2024 using JIRA 7.5.2#75007-sha1:9f5725bb824792b3230a5d8716f0c13e296a3cae.