Import-on-demand declaration with subpackages only

无人久伴 提交于 2019-12-05 12:17:51
Jens Schauder

I think what you are looking for is section7.4.3

A package is observable if and only if either:

  • A compilation unit containing a declaration of the package is observable (§7.3).

  • A subpackage of the package is observable.

The packages java, java.lang, and java.io are always observable.

And in 7.5.2

It is a compile-time error if the named package or type is not accessible (§6.6).

So if nothing is in a package it does not exists and the bug is actually on the side of the Eclipse compiler; it's described in a very old bug report that was left in "LATER" state until eventually that state was deprecated and it was moved to WONT_FIX instead. Feel free to re-open it if you think it's worth fixing (now that the JLS is clarified in this area)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!