Repository: apache/dubbo
File: dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/rest/mapping/DefaultRequestMappingRegistry.java (Java)

Code before:
                        methodMeta.setMethodDescriptor(md);
                    }
                    if (classMapping != null) {
                        methodMapping = classMapping.combine(methodMapping);
                    }
                    methodMeta.initParameters();
                    MethodMetadata methodMetadata = MethodMetadata.fromMethodDescriptor(md);
                    register0(methodMapping, new HandlerMeta(invoker, methodMeta, methodMetadata, md, sd), counter);
                });
            }
        });
        onMappingChanged();
        LOGGER.info(
                "Registered {} rest mappings for service [{}] at url [{}] in {}ms",
                counter,
                ClassUtils.toShortString(service),
                url.toString(""),
                System.currentTimeMillis() - start);
    }

    private void register0(RequestMapping mapping, HandlerMeta handler, AtomicInteger counter) {
        lock.writeLock().lock();
        try {
            Registration registration = new Registration(mapping, handler);
            for (PathExpression path : mapping.getPathCondition().getExpressions()) {
                Registration exists = tree.addPath(path, registration, Registration::equals);
                if (exists == null) {
                    counter.incrementAndGet();
                    if (LOGGER.isDebugEnabled()) {
                        String msg = "Register rest mapping: '{}' -> mapping={}, method={}";
                        LOGGER.debug(msg, path, mapping, handler.getMethod());
                    }
                } else if (LOGGER.isWarnEnabled()) {
                    LOGGER.internalWarn(Messages.DUPLICATE_MAPPING.format(path, mapping, handler.getMethod(), exists));
                }
            }
        } finally {
            lock.writeLock().unlock();
        }
    }

    @Override
    public void unregister(Invoker<?> invoker) {
        if (tree == null) {
            return;
        }

        lock.writeLock().lock();
        try {
            tree.remove(r -> r.getMeta().getInvoker() == invoker);
            onMappingChanged();

Review comment (suggestion):
You cannot use `equals`, you need to check whether the method lists intersect, try add the following method to Registration: 
```
    public boolean isMethodOverlap(Registration registration) {
        MethodsCondition self = mapping.getMethodsCondition();
        MethodsCondition other = registration.getMapping().getMethodsCondition();
        return self == null || other == null || !Collections.disjoint(self.getMethods(), other.getMethods());
    }
```

Code after:
                        methodMeta.setMethodDescriptor(md);
                    }
                    if (classMapping != null) {
                        methodMapping = classMapping.combine(methodMapping);
                    }
                    methodMeta.initParameters();
                    MethodMetadata methodMetadata = MethodMetadata.fromMethodDescriptor(md);
                    register0(methodMapping, new HandlerMeta(invoker, methodMeta, methodMetadata, md, sd), counter);
                });
            }
        });
        onMappingChanged();
        LOGGER.info(
                "Registered {} rest mappings for service [{}] at url [{}] in {}ms",
                counter,
                ClassUtils.toShortString(service),
                url.toString(""),
                System.currentTimeMillis() - start);
    }

    private void register0(RequestMapping mapping, HandlerMeta handler, AtomicInteger counter) {
        lock.writeLock().lock();
        try {
            Registration registration = new Registration(mapping, handler);
            for (PathExpression path : mapping.getPathCondition().getExpressions()) {
                Registration exists = tree.addPath(path, registration, Registration::isMappingOverlap);
                if (exists == null) {
                    counter.incrementAndGet();
                    if (LOGGER.isDebugEnabled()) {
                        String msg = "Register rest mapping: '{}' -> mapping={}, method={}";
                        LOGGER.debug(msg, path, mapping, handler.getMethod());
                    }
                } else if (LOGGER.isWarnEnabled()) {
                    LOGGER.internalWarn(Messages.DUPLICATE_MAPPING.format(path, mapping, handler.getMethod(), exists));
                }
            }
        } finally {
            lock.writeLock().unlock();
        }
    }

    @Override
    public void unregister(Invoker<?> invoker) {
        if (tree == null) {
            return;
        }

        lock.writeLock().lock();
        try {
            tree.remove(r -> r.getMeta().getInvoker() == invoker);
            onMappingChanged();