@ApiStatus.OverrideOnly 标记的 API 方法的调用。
The @ApiStatus.OverrideOnly annotation indicates that the annotated method is supposed to be implemented or overridden by
client code, but not called by it directly.
This pattern commonly appears in extension mechanisms where your implementation must conform to some interface, but it's not your
responsibility to call it.
One example of such an extension mechanism is the Service Provider Interface.
使用此注解标记类或接口与使用它标记每个方法相同。
@ApiStatus.OverrideOnly 注解表示该方法是 SPI(服务提供程序接口)的一部分。
声明库的客户端应实现或重写此类方法,而不是直接调用。
使用此注解标记类或接口与使用它标记每个方法相同。
示例:
// In upstream library code
@ApiStatus.OverrideOnly
public class MyService {
public void perform();
}
// In downstream client code
public class Foo {
public void bar(myService: MyService) {
myService.perform();
}
}
This inspection also detects the following problems related to applying the annotation incorrectly:
@ApiStatus.OverrideOnly