dubbo icon indicating copy to clipboard operation
dubbo copied to clipboard

dubbo-compatible @SPI interface compatible not work

Open imsunv opened this issue 6 years ago • 1 comments

  • Dubbo version: 2.7.7

EG:

SPI interface in apache dubbo

package org.apache.dubbo.common.extension;

/**
 * ExtensionFactory
 */
@SPI
public interface ExtensionFactory {
...
}

compatible class with alibaba dubbo

package com.alibaba.dubbo.common.extension;

@Deprecated
public interface ExtensionFactory extends org.apache.dubbo.common.extension.ExtensionFactory {

}

Not ADD @SPI annotation

    public static <T> ExtensionLoader<T> getExtensionLoader(Class<T> type) {
         .....
        if (!withExtensionAnnotation(type)) {
            throw new IllegalArgumentException("Extension type (" + type +
                    ") is not an extension, because it is NOT annotated with @" + SPI.class.getSimpleName() + "!");
        }
       ....
        return loader;
    }

In ExtensionLoader#getExtensionLoader will check failed and throw Exception.

BTW, ExtensionLoader not provided compatible class.

imsunv avatar Jul 08 '20 03:07 imsunv

Not ADD @SPI annotation

I've added @SPI to alibaba.ExtensionFactory in #6436

BTW, ExtensionLoader not provided compatible class.

Why do we need a compatible ExtensionLoader, could you please further explain?

chickenlj avatar Jul 08 '20 16:07 chickenlj