开发者

Is it possible to automatically import other packages in the caller's namespace?

开发者 https://www.devze.com 2023-03-02 10:24 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号