groovy-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Johnson <john...@cs.uiuc.edu>
Subject Re: question about Groovy syntax
Date Tue, 07 Jul 2015 19:26:22 GMT
Thanks for your answer.   I had never heard of "extension descriptors" and
would not have known where to look for them.  But Google showed me some
blogs on it, and I was able to figure it out.

-Ralph Johnson

On Thu, Jul 2, 2015 at 11:04 AM, C├ędric Champeau <cedric.champeau@gmail.com>
wrote:

> This suggests that the extension descriptor is not on classpath. Usually
> an extension is bundled as a jar, which contains the descriptor. So if you
> are using this jar, it should work. If you are using an exploded form, then
> make sure the descriptor is on classpath.
>
> 2015-07-02 17:51 GMT+02:00 Ralph Johnson <johnson@cs.uiuc.edu>:
>
>> I'm using a package called gprof that profiles Groovy code, and it has
>> been very useful.
>>
>> You are supposed to be able to write
>>
>> profile {your code goes here}.prettyPrint()
>>
>> and it will print out a profile of your code on the console.   But that
>> doesn't work for me.  I read the code and found what I thought was the
>> definition of "profile" in ProfileStaticExtension
>>
>> Its definition is
>>
>> public class ProfileStaticExtension {
>>
>>     static Report profile(Object selfType, Callable profiled) {
>>
>>         return new Profiler().run(profiled);
>>
>>     }
>>
>>     static Report profile(Object selfType, Map options, Callable
>> profiled) {
>>
>>         return new Profiler().run(options, profiled);
>>
>>     }
>>
>> }
>>
>> So, I tried writing
>>
>> ProfileStaticExtension.profile(null, {your code goes here}).prettyPrint()
>>
>> and that worked!   Do you have any idea why the syntax that they
>> advertised doesn't work?  It certainly is a nicer syntax than what I am
>> using.  I'm using it in Eclipse and I thought maybe I had the class path
>> set up incorrectly, but it looks good to me.
>>
>> new Profiler.profile({your code here}).prettyPrint() works, too.
>>
>
>

Mime
View raw message