标记为已弃用的第三方类别 [英] Mark as deprecated third party class

查看:70
本文介绍了标记为已弃用的第三方类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些第三方库 Foo ,其类为 FooBar 。我认为 FooBar 类设计不良。我想编写自己的 MyBar 作为适配器模式。我可以在不修改其代码的情况下将原始 FooBar 标记为 @Deprecated 吗?

I have some third party library Foo with class FooBar. I think that class FooBar is badly designed. I want to write my own MyBar as adapter pattern. Can I mark the original FooBar as @Deprecated without modifying its code?

推荐答案

@deprecated 应该添加到源中,以将类/方法标记为不赞成使用。因此,您不能不赞成别人的代码。

@deprecated should be added to the source to flag the class/method as deprecated. So you cannot deprecate someone else's code.

但是,如果您有一个更好的替代方案,您更愿意在项目中使用它作为 standard ,您可以通过其他方式强加此标准,例如,在 checkstyle 中。

However if you have a better alternative that you prefer to use in your project as a standard, then you can impose this standard in other ways, as a rule in checkstyle for instance.

这篇关于标记为已弃用的第三方类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆