Search code examples
javaarraysbytecodedisassemblybytecode-manipulation

How to express Java Double Array type (fixing disassembled code)


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?


Solution

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

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

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

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