protected String methodDecl(MethodDoc method,
                                ClassDoc clazz, String cname)
        throws ClassNotFoundException {
        String res = null;

        Type retType = method.returnType();
        String typesig = method.signature();
        TypeSignature newTypeSig = new TypeSignature(root);
        String sig = newTypeSig.getTypeSignature(typesig, retType);
        boolean longName = needLongName(method, clazz);

        if (sig.charAt(0) != '(')
            Util.error("invalid.method.signature", sig);


        res = "JNIEXPORT " + jniType(retType) + " JNICALL" + lineSep + jniMethodName(method, cname, longName)
            + "(JNIEnv *, " + cRcvrDecl(method, cname);
        Parameter[] params = method.parameters();
        Type argTypes[] = new Type[params.length];
        for(int p = 0; p <  params.length; p++){
            argTypes[p] =  params[p].type();
        }

        /* It would have been nice to include the argument names in the
           declaration, but there seems to be a bug in the "BinaryField"
           class, causing the getArguments() method to return "null" for
           most (non-constructor) methods. */
        for (int i = 0; i < argTypes.length; i++)
            res = res + ", " + jniType(argTypes[i]);
        res = res + ");" + lineSep;
        return res;
    }