What does "discouraged reference" mean in Java?
I noticed this setting in Eclipse's compiler settings. How is this diffe开发者_如何学Pythonrent than a "forbidden reference"?
From a comment on the accepted answer on how to open the find type dialog programmatically in eclipse
You get a discouraged access warning whenever you reference a type in a package that is not part of the API, typically these are *.internal packages. "Discouraged access" is an indicator that you should look for an API alternative if possible. Be aware that you might be vulnerable to change in later versions of Eclipse. See help.eclipse.org/galileo/index.jsp for more details – Rich Seller
Eclipse has Internal packages that are not intended for use by downstream plug-ins. However, these packages are visible to downstream plug-ins by default.
A discouraged reference is a reference in your code to one of the Eclipse internal packages.
You can find more information in the Plug-in Development Environment Guide -> Tools -> Editors -> Plug-in manifest editor -> Plug-in run time -> Access Rules.
a discouraged refrence is one that throws a warning by default whereas a forbidden reference is one that throws an error. They are similar contraindications but they differ in severity.
精彩评论