如何以编程方式删除Groovy中的默认导入? [英] How programmatically remove default import in Groovy?

查看:113
本文介绍了如何以编程方式删除Groovy中的默认导入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,某些包将导入到Groovy类中。我知道你可以使用ImportCustomizer添加新的程序,但有没有办法以编程的方式将它们删除?

By default some packages are imported in a Groovy class. I know that you can add new one with an ImportCustomizer but is there a way to remove them programmatically?

预先感谢您的回答。

推荐答案

这不是一个很好的解决方案,但它可以工作:

It is not a pretty good solution but it works:

Arrays.fill(ResolveVisitor.DEFAULT_IMPORTS, "java.lang.");

这篇关于如何以编程方式删除Groovy中的默认导入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆