diff --git a/pom.xml b/pom.xml index bb64491..fb3b5f3 100644 --- a/pom.xml +++ b/pom.xml @@ -132,4 +132,29 @@ + + + + aliyun + https://maven.aliyun.com/repository/public + + true + + + false + + + + + + aliyun-plugin + https://maven.aliyun.com/repository/public + + true + + + false + + + diff --git a/src/main/java/xyz/zhouxy/plusone/commons/annotation/DefinedIn.java b/src/main/java/xyz/zhouxy/plusone/commons/annotation/DefinedIn.java new file mode 100644 index 0000000..eb21c73 --- /dev/null +++ b/src/main/java/xyz/zhouxy/plusone/commons/annotation/DefinedIn.java @@ -0,0 +1,12 @@ +package xyz.zhouxy.plusone.commons.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.SOURCE) +public @interface DefinedIn { + Class[] value(); +} diff --git a/src/test/java/xyz/zhouxy/plusone/commons/annotation/ExplicitImplTest.java b/src/test/java/xyz/zhouxy/plusone/commons/annotation/ExplicitImplTest.java new file mode 100644 index 0000000..ab91be7 --- /dev/null +++ b/src/test/java/xyz/zhouxy/plusone/commons/annotation/ExplicitImplTest.java @@ -0,0 +1,45 @@ +package xyz.zhouxy.plusone.commons.annotation; + +import static org.junit.jupiter.api.Assertions.*; + +import org.junit.jupiter.api.Test; + +class ExplicitImplTest { + + @Test + void test() { + + } +} + +interface A { + + void fooA(); + + void fooAll(); +} + +interface B { + + void fooB(); + + void fooAll(); +} + +class C implements A, B { + + @DefinedIn(A.class) + @Override + public void fooA() { + } + + @DefinedIn(B.class) + @Override + public void fooB() { + } + + @DefinedIn({ A.class, B.class }) + @Override + public void fooAll() { + } +}