Method other = (Method)methodMap.get(methodKey);  if( other != null && compare( other, method ) >= 0 ){  checkReturnTypesEqual(method, other);  }else{   methodMap.put(methodKey, method);
Method existing = (Method)methodMap.get(methodKey);  if (existing == null || (Modifier.isProtected(existing.getModifiers()) && Modifier.isPublic(method.getModifiers()))) { methodMap.put(methodKey, method); } else { checkReturnTypesEqual(method, existing);
    protected void generate() throws NoSuchMethodException {        if (wreplace == null) {            wreplace = Enhancer.InternalReplace.class.getMethod("writeReplace", TYPES_OBJECT);        }                declare_interface(Factory.class);        declare_field(Modifier.PRIVATE, MethodInterceptor.class, INTERCEPTOR_FIELD);        if (delegating) {            declare_field(Modifier.PRIVATE, getSuperclass(), DELEGATE_FIELD);        }        generateConstructor();        generateFactory();        generateFindClass();        // Order is very important: must add superclass, then        // its superclass chain, then each interface and        // its superinterfaces.        List allMethods = new LinkedList();        addDeclaredMethods(allMethods, getSuperclass());        if (interfaces != null) {            declare_interfaces(interfaces);            for (int i = 0; i < interfaces.length; i++) {                addDeclaredMethods(allMethods, interfaces[i]);            }        }        boolean declaresWriteReplace = false;        Package packageName = getSuperclass().getPackage();        Map methodMap = new HashMap();                        for (Iterator it = allMethods.iterator(); it.hasNext();) {            Method method = (Method)it.next();            int mod = method.getModifiers();            if (!Modifier.isStatic(mod) &&                (!delegating || !Modifier.isProtected(mod)) &&                isVisible(method, packageName)) {                if (method.getName().equals("writeReplace") &&                    method.getParameterTypes().length == 0) {                    declaresWriteReplace = true;                }                Object methodKey = MethodWrapper.newInstance(method);                Method other = (Method)methodMap.get(methodKey);                                if( other != null && compare( other, method ) >= 0 ){                                        checkReturnTypesEqual(method, other);                                   }else{                                        //addDeclaredMethods adds methods reverse order                     methodMap.put(methodKey, method);                }                            }        }        List methodList = new ArrayList(methodMap.values());        List list = new ArrayList();                int privateFinalStatic = Modifier.PRIVATE | Modifier.FINAL | Modifier.STATIC;        for (int i = 0, j = 0, size = methodList.size(); j < size; j++) {            Method method = (Method)methodList.get(j);            if( Modifier.isFinal(method.getModifiers()) ||                 ( null != filter && !filter.accept(method))   ){                continue;            }                           String fieldName = getFieldName(i);            String accessName = getAccessName(method, i);            declare_field(privateFinalStatic, Method.class, fieldName);            declare_field(privateFinalStatic, MethodProxy.class, accessName);            generateAccessMethod(method, accessName);            generateAroundMethod(method, fieldName, accessName);            list.add(method);            i++;        }        generateClInit(list);        if (!declaresWriteReplace) {            generateWriteReplace();        }    }