protected void forwardDecls(PrintWriter pw, ClassDoc clazz)
        throws ClassNotFoundException {
        ClassDoc clazzfield = null;

        if (clazz.qualifiedName().equals("java.lang.Object"))
            return;
        genHandleType(pw, clazz.qualifiedName());
        ClassDoc superClass = clazz.superclass();

        if(superClass != null){
            String superClassName = superClass.qualifiedName();
            forwardDecls(pw, superClass);
        }

        for (int i = 0; i < fields.length; i++) {
            FieldDoc field = (FieldDoc)fields[i];

            if (!field.isStatic()) {
                Type t = field.type();
                String tname = t.qualifiedTypeName();
                TypeSignature newTypeSig = new TypeSignature(root);
                String sig = newTypeSig.getTypeSignature(tname);

                if (sig.charAt(0) != '[')
                    forwardDeclsFromSig(pw, sig);
            }
        }

        for (int i = 0; i < methods.length; i++) {
            MethodDoc method = (MethodDoc)methods[i];

            if (method.isNative()) {
                Type retType = method.returnType();
                String typesig = method.signature();
                TypeSignature newTypeSig = new TypeSignature(root);
                String sig = newTypeSig.getTypeSignature(typesig, retType);

                if (sig.charAt(0) != '[')
                    forwardDeclsFromSig(pw, sig);

            }
        }
    }