【问题标题】:ECommandService Discouraged accessECommandService 不鼓励访问
【发布时间】:2014-04-30 15:46:56
【问题描述】:

我正在尝试将 ECommandService 注入我的应用程序的一部分,并且我添加了插件 org.eclipse.e4.core.commands;bundle-version="0.10.2" 到我的应用程序(plugin.xml)的依赖项,但是当我声明

@Inject private ECommandService commandService;

我收到一条警告:

Discouraged access: The type ECommandService is not accessible due to 
restriction on required library C:\Data\andrelop\transnet\eclipse-
kepler\plugins\org.eclipse.e4.core.commands_0.10.2.v20130515-1857.jar

这是正常的还是我添加了错误的依赖项?

【问题讨论】:

    标签: java osgi eclipse-rcp e4


    【解决方案1】:

    这对于许多 e4 API 来说是正常的。这些 API 尚未最终确定,因此“不鼓励”它们 - 但您必须将它们用于 e4 应用程序。它们有可能在未来的 Eclipse 版本中发生变化。

    您可以在Deprecated and restricted API 部分将Discouraged reference (access rules) 更改为ignore 中关闭Preferences > Java > Compiler > Errors/Warning 中的警告。或者你可以在你的课堂上使用@SuppressWarning("restriction")

    Eclipse 错误412373 将列出将在 Eclipse 4.4 (Luna) 中完成的 API,但目前它是空的。一些 e4 API 是在 4.3 发布时完成的。

    【讨论】:

      猜你喜欢
      • 2019-08-22
      • 1970-01-01
      • 2015-06-14
      • 2012-10-03
      • 1970-01-01
      • 1970-01-01
      • 2015-02-03
      • 2011-12-19
      • 1970-01-01
      相关资源
      最近更新 更多