开发者

Groovy Source Code Question

Today i decided to see up Groovy source code and to built up my programming muscles in Groovy. I downloaded the Groovy Source code 1.8 from this link. But how do i proceed? In sense which folder first i have to see, so that i can understand better how groovy works(because there are many folders like benchmarks,bootstraps, src etc). May be this seems to be stupid question but i wanna to ask it.

Correct me if am开发者_如何学运维 worng.


The source code is inside src/main. The unit tests all live inside src/test.

I found a good place to start looking was inside the huge class:

src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java

This is where a lot of the extra Groovy methods are defined, so you can pick your favourite function (such as String.capitalize for example) and find the definition of that method (around line 9561, but that might be different in the version of the code you have downloaded)

You should then be able to (for example) change how something works, and check that the unit tests still function by calling

ant test

from the root folder, then you should see it build and test reports should be created and placed in the target folder

I tend to use a combination of find and grep to locate the area in the source that I am interested in, then slowly expand out from that class as I find other things that relate to it...

Hope this helps...it's a bit of a big question to try and cover

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜