在Java中弃用包的最简单方法是什么? [英] What is the clearest way to deprecate a package in Java?

查看:430
本文介绍了在Java中弃用包的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个新的代码库并将系统迁移到一个新的框架。

I'm working on a new codebase and migrating the system to a new framework.

有很多我想弃用的软件包,只是为了让其他开发人员明白这个包中的所有内容都不应再用于新开发。

There are a number of packages that I would like to deprecate, just to make it very clear to other developers that everything inside this package should not be used anymore for new development.

表明整个软件包已被弃用的最佳方法是什么?

What is the best way to indicate that an entire package has been deprecated?

推荐答案

你自己说过:你想弃用里面包里的所有东西,而不是包装本身。该包只是一个命名空间,并且弃用命名空间会有不同的含义 - 比如不再使用此命名空间。像一样,不要向该命名空间添加任何新项

You said it yourself: You want to deprecate everything that's inside a package, not the package itself. The package is nothing but a namespace and deprecating a namespace would have a different meaning - like don't use this namespace anymore. Like don't add any new items to that namespace.

在您的情况下,我建议您弃用每个公共方法(和字段)每个不应再使用的课程。这在现代IDE中变得可见,并且当开发人员想要使用旧的类和方法时会被警告。您可以查看代码并逐步重构,以消除这些类和方法的依赖关系。

In your case, I suggest you deprecate each public method (and field) of each class that shouldn't be used anymore. This becomes visible in modern IDE's and developers are warned when they want to use the old classes and methods. And you can look through your code and refactor it step by step to eliminate dependencies of those classes and methods.

这篇关于在Java中弃用包的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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