private void processMethods0(int mod, CtClass clazz,
                        CtMethod m, int identifier, boolean dontSearch)
        throws CannotCompileException, NotFoundException
    {
        CtMethod body;
        String name = m.getName();

        if (isExcluded(name))   // internally-used method inherited
            return;             // from a reflective class.

        CtMethod m2;
        if (m.getDeclaringClass() == clazz) {
            if (Modifier.isNative(mod))
                return;

            m2 = m;
            if (Modifier.isFinal(mod)) {
                mod &= ~Modifier.FINAL;
                m2.setModifiers(mod);
            }
        }
        else {
            if (Modifier.isFinal(mod))
                return;

            mod &= ~Modifier.NATIVE;
            m2 = CtNewMethod.delegator(findOriginal(m, dontSearch), clazz);
            m2.setModifiers(mod);
            clazz.addMethod(m2);
        }

        m2.setName(ClassMetaobject.methodPrefix + identifier
                      + "_" + name);

        if (Modifier.isStatic(mod))
            body = trapStaticMethod;
        else
            body = trapMethod;

        CtMethod wmethod
            = CtNewMethod.wrapped(m.getReturnType(), name,
                                  m.getParameterTypes(), m.getExceptionTypes(),
                                  body, ConstParameter.integer(identifier),
                                  clazz);
        wmethod.setModifiers(mod);
        clazz.addMethod(wmethod);
    }