简体   繁体   English

@CallSuper注释和UnsupportedOperationException

[英]@CallSuper Annotation and UnsupportedOperationException

I have a method that has the @CallSuper annotation, which forces sub classes to call super.methodName() . 我有一个具有@CallSuper批注的方法,该方法强制子类调用super.methodName() A subclass overrides this method and tries to throw an UnsupportedOperationException , but the compiler is still complaining that I haven't called the super method. 子类重写此方法并尝试引发UnsupportedOperationException ,但是编译器仍在抱怨我还没有调用super方法。 Is there an easy way around this? 有没有解决此问题的简单方法?

我发现可以使用@SuppressLint("MissingSuperCall")取消警告。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM