开发者

Enforce type specification on public members of Groovy types

开发者 https://www.devze.com 2023-02-11 17:31 出处:网络
In Groovy, specifying types is optional. But there are advantages to specifying them on public class members like m开发者_如何学Cethods and properties. It\'s a good form of documentation and it enable

In Groovy, specifying types is optional. But there are advantages to specifying them on public class members like m开发者_如何学Cethods and properties. It's a good form of documentation and it enables IDEs to perform auto-completion, refactor code, find references, and other static analysis tasks more reliably as described in this Groovy Coding Style article.

Is there a way to enforce this policy in Eclipse so that a warning will appear when a public member is missing an explicit type? Something along the lines of a Checkstyle or FindBugs tool for Groovy would be great.


No, there is nothing like this in Groovy-Eclipse at the moment, but this is an interesting idea. You can raise an enhancement request for this:

http://jira.codehaus.org/browse/GRECLIPSE


Just as a comment, the standard tool for groovy static analysis is codenarc. Don't know if the rule you mentioned is there, but it has a lot of options and it is continuously improving.
Regarding your question about eclipse support, I believe there is nothing like that yet.

0

精彩评论

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