groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Aseem Bansal <>
Subject Re: Convenient API reference
Date Fri, 29 Jan 2016 16:03:41 GMT
Regarding documentation for methods, I am assuming you are referring to the
method "help" of Python to get a method's doc string.

There is a difference between JVM based languages and Python. As far as I
know, in case of Python the complete source is present everywhere so the
doc strings are present for extraction. But in case of JVM langauges things
have to be compiled and the docs are lost. So it's not possible to get the
documentation from the final JAR files. That is my understanding and I
don't think it's possible to have the documentation the same way as we get
in case of Python.

Tools allow you to attach sources and if you are using something like
gradle + Intellij IDEA you can have sources for everything using
downloadSources from
And the autocomplete you get in Intellij IDEA is great.

But yeah the groovysh or groovyConsole do not provide the auto complete
like in case of Python.

On Fri, Jan 29, 2016 at 9:02 PM, Aseem Bansal <> wrote:

> I searched for "groovy File API" on google and came across the API
> reference.
> On Fri, Jan 29, 2016 at 8:58 PM, Aseem Bansal <>
> wrote:
>> For finding all methods including meta methods use something like
>> File.metaClass.metaMethods*.name.sort()
>> On Fri, Jan 29, 2016 at 2:35 PM, Александр Решитько <
>>> wrote:
>>> Thank you for the answer.
>>> Unfortunately <instance>.getClass().methods*.name  doesn't reflect all
>>> of the instance's methods (as far as i understand it misses those that are
>>> added by groovy metaprogramming facilities - returning to the File.eachLine
>>> example - it doesn't contain this method).
>>> 2016-01-29 4:43 GMT+03:00 Edinson E. Padrón Urdaneta <
>>>> ​> - given an instance of a class in a groovy shell list it's available
>>>> methods (the only thing I came up with is using a
>>>> groovy.inspect.swingui.ObjectBrowser)
>>>> What about <instance>.getClass().methods*.name (e.g.
>>>> ''.getClass().methods*.name)?
>>>> > - given a Class name find out it's API and at least short
>>>> descriptions for its members (for example groovy's File class has a neat
>>>> method eachLine which I couldn't find neither in Oracle's Java official
>>>> online API reference nor in Groovy's GDK reference - it might be there but
>>>> I haven't found it when I needed it). The result is that I use google in
>>>> such cases which isn't the right way to do it IMHO. groovysh doesn't always
>>>> give auto complete suggestions for such cases also.
>>>> Maybe you just missed it?
>>>> > - given a class method get it's documentation
>>>> Maybe someone with a greater knowledge than mine can give you a more
>>>> useful answer about this but, as far as I know, the javadocs aren't part
>>>> the bytecode, in other words, the documentation is striped away when the
>>>> source is compiled into bytecode (Python give you access to the docstrings
>>>> through the class/method/function's `__doc__` instance variable). So, you
>>>> can't access the javadocs without the source code.

View raw message