Is it possible to automatically import other packages in the caller's namespace?
If a user imports:
com.my.package
Is it possible for me to do something in my package, so that anot开发者_StackOverflow社区her package gets imported as well? For example, I'd like to have java.io
be automatically imported.
No, it is not possible. However, you can create a package object
and put type
definitions in it, so that you'll get aliases for classes you think are relevant.
精彩评论