Question

I have some code that depends on jars that were compiled using Java 1.7. I am currently working on OSX, where I only have access to Java 1.6. I am currently attempting to recompile these jars locally. However, the jars only contained the .class files. I downloaded a disassembler and saved the resultant .java files. Now, there are some errors that I am currently trying to debug. One of the files checks to see if some parameter is equal to a class or type. The problem I'm having is that there is the expression

if (paramType.equals([D.class)) { ... }

which is causing a compiler error. What is the proper way of expressing a double array class?

Was it helpful?

Solution

Assuming it's an array of (primitive) double:

if (paramType.equls(double[].class)) { ... }

Or if it's an array of (wrapper type) java.lang.Double:

if (paramType.equls(Double[].class)) { ... }

OTHER TIPS

If the classes don't link against any new library classes introduced in Java 1.7, then they should work just fine in Java 1.6, as the only bytecode features introduced in 1.7 are not actually used in Java.

All you have to do is change the 8th byte of every file from 51 to 50. You don't even have to disassemble and reassemble them.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top