<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-11867</id>
	<title>Nabble - groovy - user</title>
	<updated>2008-10-07T05:12:56Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/groovy---user-f11867.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/groovy---user-f11867.html" />
	<subtitle type="html"></subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-19856762</id>
	<title>Re: closure issue in GroovyTestCase</title>
	<published>2008-10-07T05:12:56Z</published>
	<updated>2008-10-07T05:12:56Z</updated>
	<author>
		<name>Haotian Sun</name>
	</author>
	<content type="html">I use 1.5.6 and your simple test works for me as well. But the issue is 
&lt;br&gt;that the &amp;nbsp;compiled MyTest_testMe_closure1 does not have public 
&lt;br&gt;constructor TestCase(String name) or TestCase()
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;&lt;br&gt;Roshan Dawrani wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; You may want to mention the version of groovy with which you are 
&lt;br&gt;&amp;gt; encountering this issue of not being able to use closures in your 
&lt;br&gt;&amp;gt; testcase.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; With 1.5.6, I am not seeing any issue in executing a test using 
&lt;br&gt;&amp;gt; closures as following:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; public class MyTest extends GroovyTestCase{
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; void setUp() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def list = [1, 2, 3, 5]
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def list1 = list.findAll {it &amp;gt; 2}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; println list1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; void testMe(){
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def list = [1, 2, 3, 5]
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; def list1 = list.findAll {it &amp;lt;= 2}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; println list1
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Tue, Oct 7, 2008 at 4:35 PM, Haotian Sun &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19856762&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hsun@...&lt;/a&gt; 
&lt;br&gt;&amp;gt; &amp;lt;mailto:&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19856762&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hsun@...&lt;/a&gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Hi Jochen,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Well, I'm not sure what you mean by where I collect the tests. But
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; once I have a closure involved in any part of my test, for example,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public class MyTest extends GroovyTestCase{
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; void setUp() {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qcIwd =
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; iwdXml.executionRecord.ixicoWorkflowDefinitions.IxicoWorkflowDefinition.find
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {it.@iwdtype ==
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; 'GENERIC/RESOURCES/ManualExamQC.xml?revision=157'}
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; I will have a problem as stated before. I see that the JVM will
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; compile the closure as a separate class but that one seems not to
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; extend the junits' TestCase
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Can you please explain a bit more?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Thanks
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Haotian
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; Jochen Theodorou wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Haotian Sun schrieb:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Hi guys,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I've got a junit test class which extends GroovyTestCase,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; when the class involves some Groovy class/script which
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; generate closures classes, the test will fail along with
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; the message like following:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; junit.framework.AssertionFailedError: Class
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyTest_closure1 has no public constructor TestCase(String
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; name) or TestCase()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Does anyone have idea to fix this?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; you tried to execute the closure classas junit test. You
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; should not do that. Look at where you collect the tests and
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; how you do that and fix that part ;)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; bye blackdrag
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/closure-issue-in-GroovyTestCase-tp19800939p19856762.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19856553</id>
	<title>testing assertions not working with shouldFail</title>
	<published>2008-10-07T05:00:04Z</published>
	<updated>2008-10-07T05:00:04Z</updated>
	<author>
		<name>aldana</name>
	</author>
	<content type="html">hi sometimes i want to unit-test whether an assertion is correctly filed. but somehow this does not work, groovy runtime instantly exits instead of waiting for my shouldFail assertion.
&lt;br&gt;&lt;br&gt;class SUT{
&lt;br&gt;&amp;nbsp;def static sut(param){
&lt;br&gt;&amp;nbsp; &amp;nbsp; assert sut == 3
&lt;br&gt;&amp;nbsp;}
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;public void testSut(){
&lt;br&gt;&amp;nbsp; &amp;nbsp;shouldFail(AssertionError.class,{SUT.sut(2)})
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;&lt;br&gt;instead of passing i get stack trace of java.lang.Assertion, though it should have been caught by my test method? what am i doing wrong?
&lt;br&gt;&lt;br&gt;thanks.
&lt;br&gt;&lt;br&gt;&lt;div class=&quot;signature&quot;&gt;manuel aldana
&lt;br&gt;aldana((at))gmx.de
&lt;br&gt;software-engineering blog: &lt;a href=&quot;http://www.aldana-online.de&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.aldana-online.de&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/testing-assertions-not-working-with-shouldFail-tp19856553p19856553.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19856110</id>
	<title>Re: closure issue in GroovyTestCase</title>
	<published>2008-10-07T04:26:53Z</published>
	<updated>2008-10-07T04:26:53Z</updated>
	<author>
		<name>Roshan Dawrani</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;You may want to mention the version of groovy with which you are encountering this issue of not being able to use closures in your testcase.&lt;br&gt;&lt;br&gt;With 1.5.6, I am not seeing any issue in executing a test using closures as following:&lt;br&gt;
&lt;br&gt;public class MyTest extends GroovyTestCase{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void setUp() {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; def list = [1, 2, 3, 5]&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; def list1 = list.findAll {it &amp;gt; 2}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; println list1&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; void testMe(){&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; def list = [1, 2, 3, 5]&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; def list1 = list.findAll {it &amp;lt;= 2}&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; println list1&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Tue, Oct 7, 2008 at 4:35 PM, Haotian Sun &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19856110&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hsun@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Hi Jochen,&lt;br&gt;
&lt;br&gt;
Well, I&amp;#39;m not sure what you mean by where I collect the tests. But once I have a closure involved in any part of my test, for example,&lt;br&gt;
&lt;br&gt;
public class MyTest extends GroovyTestCase{&lt;br&gt;
&lt;br&gt;
void setUp() {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; qcIwd = iwdXml.executionRecord.ixicoWorkflowDefinitions.IxicoWorkflowDefinition.find&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {it.@iwdtype == &amp;#39;GENERIC/RESOURCES/ManualExamQC.xml?revision=157&amp;#39;}&lt;br&gt;
 &amp;nbsp; }&lt;br&gt;
}&lt;br&gt;
&lt;br&gt;
I will have a problem as stated before. I see that the JVM will compile the closure as a separate class but that one seems not to extend the junits&amp;#39; TestCase&lt;br&gt;
&lt;br&gt;
Can you please explain a bit more?&lt;br&gt;
&lt;br&gt;
Thanks&lt;br&gt;
&lt;br&gt;
Haotian&lt;br&gt;
&lt;br&gt;
Jochen Theodorou wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Haotian Sun schrieb:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
Hi guys,&lt;br&gt;
&lt;br&gt;
I&amp;#39;ve got a junit test class which extends GroovyTestCase, when the class involves some Groovy class/script which generate closures classes, the test will fail along with the message like following:&lt;br&gt;
&lt;br&gt;
junit.framework.AssertionFailedError: Class MyTest_closure1 has no public constructor TestCase(String name) or TestCase()&lt;br&gt;
&lt;br&gt;
Does anyone have idea to fix this?&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
you tried to execute the closure classas junit test. You should not do that. Look at where you collect the tests and how you do that and fix that part ;)&lt;br&gt;
&lt;br&gt;
bye blackdrag&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;
&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/closure-issue-in-GroovyTestCase-tp19800939p19856110.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19855852</id>
	<title>Re: closure issue in GroovyTestCase</title>
	<published>2008-10-07T04:05:37Z</published>
	<updated>2008-10-07T04:05:37Z</updated>
	<author>
		<name>Haotian Sun</name>
	</author>
	<content type="html">Hi Jochen,
&lt;br&gt;&lt;br&gt;Well, I'm not sure what you mean by where I collect the tests. But once 
&lt;br&gt;I have a closure involved in any part of my test, for example,
&lt;br&gt;&lt;br&gt;public class MyTest extends GroovyTestCase{
&lt;br&gt;&lt;br&gt;&amp;nbsp;void setUp() {
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; qcIwd = 
&lt;br&gt;iwdXml.executionRecord.ixicoWorkflowDefinitions.IxicoWorkflowDefinition.find
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {it.@iwdtype == 
&lt;br&gt;'GENERIC/RESOURCES/ManualExamQC.xml?revision=157'}
&lt;br&gt;&amp;nbsp; &amp;nbsp; }
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;I will have a problem as stated before. I see that the JVM will compile 
&lt;br&gt;the closure as a separate class but that one seems not to extend the 
&lt;br&gt;junits' TestCase
&lt;br&gt;&lt;br&gt;Can you please explain a bit more?
&lt;br&gt;&lt;br&gt;Thanks
&lt;br&gt;&lt;br&gt;Haotian
&lt;br&gt;&lt;br&gt;Jochen Theodorou wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Haotian Sun schrieb:
&lt;br&gt;&amp;gt;&amp;gt; Hi guys,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; I've got a junit test class which extends GroovyTestCase, when the 
&lt;br&gt;&amp;gt;&amp;gt; class involves some Groovy class/script which generate closures 
&lt;br&gt;&amp;gt;&amp;gt; classes, the test will fail along with the message like following:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; junit.framework.AssertionFailedError: Class MyTest_closure1 has no 
&lt;br&gt;&amp;gt;&amp;gt; public constructor TestCase(String name) or TestCase()
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Does anyone have idea to fix this?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; you tried to execute the closure classas junit test. You should not do 
&lt;br&gt;&amp;gt; that. Look at where you collect the tests and how you do that and fix 
&lt;br&gt;&amp;gt; that part ;)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; bye blackdrag
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/closure-issue-in-GroovyTestCase-tp19800939p19855852.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19839219</id>
	<title>Re: Date.format convenience methods</title>
	<published>2008-10-06T07:36:37Z</published>
	<updated>2008-10-06T07:36:37Z</updated>
	<author>
		<name>glaforge</name>
	</author>
	<content type="html">Great job, Tom, thanks a lot!
&lt;br&gt;&lt;br&gt;On Mon, Oct 6, 2008 at 4:19 PM, Tom Nichols &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19839219&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tmnichols@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Added a static Date.parse( pattern, input ) method in r.13699. &amp;nbsp;Please
&lt;br&gt;&amp;gt; yell if I break anything -- A lot of unit tests seem to be failing for
&lt;br&gt;&amp;gt; me, even on a clean checkout -- Windows :(
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Also, I'd like to get a tally of who thinks the name (or format)
&lt;br&gt;&amp;gt; should be changed for the &amp;quot;quickie&amp;quot; Date format methods. I'll
&lt;br&gt;&amp;gt; reiterate what stands right now:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; date.dateString &amp;nbsp; &amp;nbsp;// uses DateFormat.getDateInstance( SHORT ) -
&lt;br&gt;&amp;gt; dd/MM/yy in en_UK
&lt;br&gt;&amp;gt; date.timeString &amp;nbsp; &amp;nbsp;// uses DateFormat.getTimeInstance( MEDIUM ) - HH:mm:ss
&lt;br&gt;&amp;gt; date.dateTimeString &amp;nbsp; &amp;nbsp;// uses DateFormat.getDateTimeInstance( SHORT, MEDIUM )
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think the other proposal was to use &amp;quot;format...&amp;quot; for all of the
&lt;br&gt;&amp;gt; method names like so:
&lt;br&gt;&amp;gt; date.formatDate()
&lt;br&gt;&amp;gt; date.formatTime()
&lt;br&gt;&amp;gt; date.formatDateTime()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Again, my main reason for choosing properties was to aid readability
&lt;br&gt;&amp;gt; in GStrings like
&lt;br&gt;&amp;gt; &amp;quot;Today's date is ${date.dateString}&amp;quot;
&lt;br&gt;&amp;gt; versus
&lt;br&gt;&amp;gt; &amp;quot;Today's date is ${date.formatDate()}&amp;quot;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; but if the majority likes the &amp;quot;format..&amp;quot; convention better I can
&lt;br&gt;&amp;gt; switch it. &amp;nbsp;If there isn't more significant discussion on this (or
&lt;br&gt;&amp;gt; argument on why there should be additional DGM methods) I'll consider
&lt;br&gt;&amp;gt; this done and close the JIRA issue.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks!!
&lt;br&gt;&amp;gt; -Tom
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Thu, Oct 2, 2008 at 3:31 PM, Tom Nichols &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19839219&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tmnichols@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Cool! &amp;nbsp;Created issue here: &lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3066&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3066&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Two questions -
&lt;br&gt;&amp;gt;&amp;gt; 1. &amp;nbsp;Should there be a complimentary &amp;quot;parse&amp;quot; method? &amp;nbsp;Something like
&lt;br&gt;&amp;gt;&amp;gt; new Date( 'yyyy-MM-dd', someString )
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; 2. &amp;nbsp;In lieu of creating a new SimpleDateFormat _every_ time, should
&lt;br&gt;&amp;gt;&amp;gt; there be some defaults that use DateFormat's
&lt;br&gt;&amp;gt;&amp;gt; getDateInstance/getTimeInstance, i.e.:
&lt;br&gt;&amp;gt;&amp;gt; new Date().formatDate() // see DateFormat#getDateInstance
&lt;br&gt;&amp;gt;&amp;gt; new Date().formatTime() // see DateFormat#getTimeInstance
&lt;br&gt;&amp;gt;&amp;gt; new Date().format() // or formatDateTime()
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Will have a simple implementation soon.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Thu, Oct 2, 2008 at 6:56 PM, Guillaume Laforge &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19839219&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hi Tom,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sounds like a good addition.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; On Thu, Oct 2, 2008 at 8:49 PM, Tom Nichols &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19839219&amp;i=3&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tmnichols@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; This is probably a silly question, but why is there no Date.format(..)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; GDK method? &amp;nbsp;It would basically be a wrapper for SimpleDateFormat so
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; you could do this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; new Date().format( 'yyyy-MM-dd' )
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; // returns 2008-10-02
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The same could be done for Calendar. &amp;nbsp;Does something like this
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; seriously not already exist in the Groovy API?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Guillaume Laforge
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Groovy Project Manager
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; G2One, Inc. Vice-President Technology
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Guillaume Laforge
&lt;br&gt;Groovy Project Manager
&lt;br&gt;G2One, Inc. Vice-President Technology
&lt;br&gt;&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Date.format-convenience-methods-tp19785349p19839219.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19838927</id>
	<title>Re: Date.format convenience methods</title>
	<published>2008-10-06T07:19:51Z</published>
	<updated>2008-10-06T07:19:51Z</updated>
	<author>
		<name>Tom Nichols</name>
	</author>
	<content type="html">Added a static Date.parse( pattern, input ) method in r.13699. &amp;nbsp;Please
&lt;br&gt;yell if I break anything -- A lot of unit tests seem to be failing for
&lt;br&gt;me, even on a clean checkout -- Windows :(
&lt;br&gt;&lt;br&gt;Also, I'd like to get a tally of who thinks the name (or format)
&lt;br&gt;should be changed for the &amp;quot;quickie&amp;quot; Date format methods. I'll
&lt;br&gt;reiterate what stands right now:
&lt;br&gt;&lt;br&gt;date.dateString &amp;nbsp; &amp;nbsp;// uses DateFormat.getDateInstance( SHORT ) -
&lt;br&gt;dd/MM/yy in en_UK
&lt;br&gt;date.timeString &amp;nbsp; &amp;nbsp;// uses DateFormat.getTimeInstance( MEDIUM ) - HH:mm:ss
&lt;br&gt;date.dateTimeString &amp;nbsp; &amp;nbsp;// uses DateFormat.getDateTimeInstance( SHORT, MEDIUM )
&lt;br&gt;&lt;br&gt;I think the other proposal was to use &amp;quot;format...&amp;quot; for all of the
&lt;br&gt;method names like so:
&lt;br&gt;date.formatDate()
&lt;br&gt;date.formatTime()
&lt;br&gt;date.formatDateTime()
&lt;br&gt;&lt;br&gt;Again, my main reason for choosing properties was to aid readability
&lt;br&gt;in GStrings like
&lt;br&gt;&amp;quot;Today's date is ${date.dateString}&amp;quot;
&lt;br&gt;versus
&lt;br&gt;&amp;quot;Today's date is ${date.formatDate()}&amp;quot;
&lt;br&gt;&lt;br&gt;but if the majority likes the &amp;quot;format..&amp;quot; convention better I can
&lt;br&gt;switch it. &amp;nbsp;If there isn't more significant discussion on this (or
&lt;br&gt;argument on why there should be additional DGM methods) I'll consider
&lt;br&gt;this done and close the JIRA issue.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks!!
&lt;br&gt;-Tom
&lt;br&gt;&lt;br&gt;&lt;br&gt;On Thu, Oct 2, 2008 at 3:31 PM, Tom Nichols &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19838927&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tmnichols@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Cool! &amp;nbsp;Created issue here: &lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3066&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3066&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Two questions -
&lt;br&gt;&amp;gt; 1. &amp;nbsp;Should there be a complimentary &amp;quot;parse&amp;quot; method? &amp;nbsp;Something like
&lt;br&gt;&amp;gt; new Date( 'yyyy-MM-dd', someString )
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; 2. &amp;nbsp;In lieu of creating a new SimpleDateFormat _every_ time, should
&lt;br&gt;&amp;gt; there be some defaults that use DateFormat's
&lt;br&gt;&amp;gt; getDateInstance/getTimeInstance, i.e.:
&lt;br&gt;&amp;gt; new Date().formatDate() // see DateFormat#getDateInstance
&lt;br&gt;&amp;gt; new Date().formatTime() // see DateFormat#getTimeInstance
&lt;br&gt;&amp;gt; new Date().format() // or formatDateTime()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Will have a simple implementation soon.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On Thu, Oct 2, 2008 at 6:56 PM, Guillaume Laforge &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19838927&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi Tom,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Sounds like a good addition.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Thu, Oct 2, 2008 at 8:49 PM, Tom Nichols &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19838927&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tmnichols@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; This is probably a silly question, but why is there no Date.format(..)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; GDK method? &amp;nbsp;It would basically be a wrapper for SimpleDateFormat so
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; you could do this:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; new Date().format( 'yyyy-MM-dd' )
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; // returns 2008-10-02
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The same could be done for Calendar. &amp;nbsp;Does something like this
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; seriously not already exist in the Groovy API?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt; Guillaume Laforge
&lt;br&gt;&amp;gt;&amp;gt; Groovy Project Manager
&lt;br&gt;&amp;gt;&amp;gt; G2One, Inc. Vice-President Technology
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Date.format-convenience-methods-tp19785349p19838927.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19836119</id>
	<title>Re: Gant and Gradle</title>
	<published>2008-10-06T04:25:25Z</published>
	<updated>2008-10-06T04:25:25Z</updated>
	<author>
		<name>hdockter</name>
	</author>
	<content type="html">Hi,
&lt;br&gt;&lt;br&gt;On Oct 4, 2008, at 11:07 AM, Russel Winder wrote:
&lt;br&gt;&lt;br&gt;&amp;lt;snip&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ever since Hans Dockter realized that he was not going to be able to
&lt;br&gt;&amp;gt; build Gradle on Gant, but would have to have a new code base to &amp;nbsp;
&lt;br&gt;&amp;gt; achieve
&lt;br&gt;&amp;gt; his goals, there has been a tension between the roles of Gant and
&lt;br&gt;&amp;gt; Gradle. &amp;nbsp;The core technical difference between Gant and Gradle is that
&lt;br&gt;&amp;gt; Gant is simply a scripting systems whereas Gradle works with a DAG &amp;nbsp;
&lt;br&gt;&amp;gt; as do
&lt;br&gt;&amp;gt; Make, Ant, Maven, SCons, etc.
&lt;br&gt;&lt;br&gt;Maven unfortunately does not use a DAG. This is another reason for &amp;nbsp;
&lt;br&gt;its inflexibility IMO.
&lt;br&gt;&lt;br&gt;&amp;gt; -- Gant is the odd one out here as a build
&lt;br&gt;&amp;gt; framework, it does not build a data structure and reflect on that, it
&lt;br&gt;&amp;gt; just executes code.
&lt;br&gt;&lt;br&gt;I would say that Gant uses an implicit DAG created at runtime. This &amp;nbsp;
&lt;br&gt;is what the 'depends' call is all about, isn't it. To me this is the &amp;nbsp;
&lt;br&gt;same way as Ant is doing things.
&lt;br&gt;&lt;br&gt;&amp;lt;snip&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;gt; Gant is just a single jar and so is very lightweight whereas Gradle &amp;nbsp;
&lt;br&gt;&amp;gt; has
&lt;br&gt;&amp;gt; a lot of dependencies and is relatively heavyweight.
&lt;br&gt;&lt;br&gt;This is a very valid point. Therefore we will put a lot of effort &amp;nbsp;
&lt;br&gt;into modularization soon.
&lt;br&gt;&lt;br&gt;&amp;lt;snip&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;gt; Gradle can support many of the Ant task scripting things that Gant &amp;nbsp;
&lt;br&gt;&amp;gt; does
&lt;br&gt;&amp;gt; but Gant is so much more lightweight than Gradle for doing this.
&lt;br&gt;&lt;br&gt;Definitely in terms of size and dependencies (see above). Do you also &amp;nbsp;
&lt;br&gt;see a difference in regard to coding?
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am increasingly of the view that Gant should cease trying to be a
&lt;br&gt;&amp;gt; build framework and leave this role to a rapidly evolving Gradle. &amp;nbsp; 
&lt;br&gt;&amp;gt; Gant
&lt;br&gt;&amp;gt; should instead reposition itself as a lightweight, embeddable Ant task
&lt;br&gt;&amp;gt; scripting system. &amp;nbsp;This is exactly how it is used in Grails. &amp;nbsp; 
&lt;br&gt;&amp;gt; Embedding
&lt;br&gt;&amp;gt; Gradle to do the Ant task scripting would for me be using too
&lt;br&gt;&amp;gt; heavyweight a tool for the task at hand -- though having a Gradle &amp;nbsp;
&lt;br&gt;&amp;gt; rather
&lt;br&gt;&amp;gt; than an Ant build for Grails and indeed Groovy might be a good move.
&lt;/div&gt;&lt;br&gt;I think it is time for Groovy (I don't know the Grails build) to show &amp;nbsp;
&lt;br&gt;the world by its build the advantages of a Groovy based internal DSL :)
&lt;br&gt;&lt;br&gt;&amp;lt;snip&amp;gt;
&lt;br&gt;&lt;br&gt;- Hans
&lt;br&gt;&lt;br&gt;--
&lt;br&gt;Hans Dockter
&lt;br&gt;Gradle Project lead
&lt;br&gt;&lt;a href=&quot;http://www.gradle.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.gradle.org&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Gant-and-Gradle-tp19810296p19836119.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19824573</id>
	<title>Re: Groovy as arithmetic expression evaluator?</title>
	<published>2008-10-05T06:27:27Z</published>
	<updated>2008-10-05T06:27:27Z</updated>
	<author>
		<name>Jochen Theodorou</name>
	</author>
	<content type="html">HamletDRC schrieb:
&lt;br&gt;&amp;gt; Is there a way to cleanly add a static import for Math other than just
&lt;br&gt;&amp;gt; appending &amp;quot;import static java.lang.Math.*&amp;quot; to the front of the groovyshell
&lt;br&gt;&amp;gt; input? 
&lt;br&gt;&lt;br&gt;ModuleNode#addStaticImportClass(importClassString, classNode)
&lt;br&gt;&lt;br&gt;bye blackdrag
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Jochen &amp;quot;blackdrag&amp;quot; Theodorou
&lt;br&gt;The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)
&lt;br&gt;&lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19824573.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19813256</id>
	<title>RE: Gant and Gradle</title>
	<published>2008-10-04T08:37:10Z</published>
	<updated>2008-10-04T08:37:10Z</updated>
	<author>
		<name>David Sills</name>
	</author>
	<content type="html">Russell:
&lt;br&gt;&lt;br&gt;Your proposal as to the futures of Gant and Gradle seems very reasonable
&lt;br&gt;to me. I see the advantages of both, so long as they don't tend toward
&lt;br&gt;each other in a vain attempt to be all things to all people.
&lt;br&gt;&lt;br&gt;Repositioning Gant as principally a scripting framework for Ant tasks
&lt;br&gt;and Gradle as principally a build framework seems like a reasonable
&lt;br&gt;development given the lightweight/heavyweight description you supply. Of
&lt;br&gt;course, there will be folks who will be able to use Gant as a build
&lt;br&gt;framework for simple cases, which is perfectly fine, too; just as there
&lt;br&gt;are those who feel it is appropriate to use a business card to spread
&lt;br&gt;jam on toast if a knife isn't ready to hand - and long may they do so!
&lt;br&gt;:)
&lt;br&gt;&lt;br&gt;My $0.02.
&lt;br&gt;&lt;br&gt;David Sills
&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Gant-and-Gradle-tp19810296p19813256.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19813177</id>
	<title>Re: [grails-user] Gant and Gradle</title>
	<published>2008-10-04T08:29:47Z</published>
	<updated>2008-10-04T08:29:47Z</updated>
	<author>
		<name>Bashar Jawad</name>
	</author>
	<content type="html">This comparison sounds to me exactly like the one between Ant and Maven.
&lt;br&gt;Maven and Ant both serve different purposes - Gant to me sounds just 
&lt;br&gt;like Ant while Gradle sounds like Maven.
&lt;br&gt;The solution ? continue to develop both independently - Gant should 
&lt;br&gt;focus on being a build scripting tool while Gradle should focus on being 
&lt;br&gt;a project management tool.
&lt;br&gt;Add support to running Gant scripts in Gradle - just like Maven supports 
&lt;br&gt;running Ant tasks.
&lt;br&gt;&lt;br&gt;Bashar
&lt;br&gt;Russel Winder wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Please excuse the very wide initial circulation of this, but I want to
&lt;br&gt;&amp;gt; make sure people are aware that there is a debate that might affect
&lt;br&gt;&amp;gt; them. &amp;nbsp;I suspect the best place for the debate is the Gant Users email
&lt;br&gt;&amp;gt; list, so if people could be careful about which list they reply to when
&lt;br&gt;&amp;gt; replying then people not interested in the debate will not get flooded
&lt;br&gt;&amp;gt; -- i.e. please check carefully where you are sending replies if you
&lt;br&gt;&amp;gt; reply to this email. &amp;nbsp;Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Ever since Hans Dockter realized that he was not going to be able to
&lt;br&gt;&amp;gt; build Gradle on Gant, but would have to have a new code base to achieve
&lt;br&gt;&amp;gt; his goals, there has been a tension between the roles of Gant and
&lt;br&gt;&amp;gt; Gradle. &amp;nbsp;The core technical difference between Gant and Gradle is that
&lt;br&gt;&amp;gt; Gant is simply a scripting systems whereas Gradle works with a DAG as do
&lt;br&gt;&amp;gt; Make, Ant, Maven, SCons, etc. -- Gant is the odd one out here as a build
&lt;br&gt;&amp;gt; framework, it does not build a data structure and reflect on that, it
&lt;br&gt;&amp;gt; just executes code.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; On and off over the last year (and very much on over the last couple of
&lt;br&gt;&amp;gt; weeks) Hans and I have debated (privately) this issue of the tension
&lt;br&gt;&amp;gt; between Gant and Gradle. &amp;nbsp;Now though is the right time to open and widen
&lt;br&gt;&amp;gt; this debate.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; In the Java milieu, Ant and Maven are the dominant build tools, though
&lt;br&gt;&amp;gt; as an increasing number of people are realizing, using Groovy instead of
&lt;br&gt;&amp;gt; XML as the build specification notation is a Big Win (tm) -- I get a
&lt;br&gt;&amp;gt; continuous stream of emails (and I am sure Hans gets analogous emails)
&lt;br&gt;&amp;gt; saying &amp;quot;Wow I just tried Gant and it is just so much nicer than Ant as
&lt;br&gt;&amp;gt; Groovy is just so much better than XML&amp;quot;. &amp;nbsp;So the core question is how to
&lt;br&gt;&amp;gt; make a Groovy-based build framework the dominant player in the Java
&lt;br&gt;&amp;gt; world. &amp;nbsp;Should we push both Gant and Gradle independently and see what
&lt;br&gt;&amp;gt; happens or should we engineer things a little more so as to have a
&lt;br&gt;&amp;gt; greater chance of success?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There are many issues here, a few of which follow:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Gant is just a scripting system and so doesn't really have all the
&lt;br&gt;&amp;gt; infrastructure to do many of the things expected of a build framework,
&lt;br&gt;&amp;gt; Gradle does. &amp;nbsp;This implies Gradle is a better weapon for getting Groovy
&lt;br&gt;&amp;gt; as the major build framework.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Gant is just a single jar and so is very lightweight whereas Gradle has
&lt;br&gt;&amp;gt; a lot of dependencies and is relatively heavyweight. &amp;nbsp;Of course Gant is
&lt;br&gt;&amp;gt; just a scripting replacement for the XML front end to Ant &amp;nbsp;whereas
&lt;br&gt;&amp;gt; Gradle is a complete Ivy-based build framework that supports management
&lt;br&gt;&amp;gt; over the whole project lifecycle.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; People are increasingly asking for changes to Gant that can be achieved
&lt;br&gt;&amp;gt; in a way, but really need DAG support which is already handled by
&lt;br&gt;&amp;gt; Gradle.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Gradle can support many of the Ant task scripting things that Gant does
&lt;br&gt;&amp;gt; but Gant is so much more lightweight than Gradle for doing this.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; No-one seems to be interested in supporting Gant plugins for Eclipse,
&lt;br&gt;&amp;gt; NetBeans or IntelliJ IDEA which is limiting its acceptance where IDEs
&lt;br&gt;&amp;gt; are mandatory whereas work is in progress on Gradle plugins -- at least
&lt;br&gt;&amp;gt; for Eclipse.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There are many other issues but this will do for the present (to try and
&lt;br&gt;&amp;gt; keep this email to some semblance of reasonable length :-) 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Where am I going with this?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I am increasingly of the view that Gant should cease trying to be a
&lt;br&gt;&amp;gt; build framework and leave this role to a rapidly evolving Gradle. &amp;nbsp;Gant
&lt;br&gt;&amp;gt; should instead reposition itself as a lightweight, embeddable Ant task
&lt;br&gt;&amp;gt; scripting system. &amp;nbsp;This is exactly how it is used in Grails. &amp;nbsp;Embedding
&lt;br&gt;&amp;gt; Gradle to do the Ant task scripting would for me be using too
&lt;br&gt;&amp;gt; heavyweight a tool for the task at hand -- though having a Gradle rather
&lt;br&gt;&amp;gt; than an Ant build for Grails and indeed Groovy might be a good move.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Recently a number of people have made proposals for change to Gant and
&lt;br&gt;&amp;gt; many of these are good proposals (especially the ones accompanied by
&lt;br&gt;&amp;gt; patches :-) and I propose to evolve Gant with these proposals where they
&lt;br&gt;&amp;gt; fit with Gant being just a lightweight Ant task scripting system. &amp;nbsp;Where
&lt;br&gt;&amp;gt; the changes are more to do with Gant becoming an improved build
&lt;br&gt;&amp;gt; framework, I am contemplating not making the changes -- especially those
&lt;br&gt;&amp;gt; where Gradle already does that which is needed. 
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; OK, I think this introduces the base issues, and this email is already
&lt;br&gt;&amp;gt; long. &amp;nbsp;I am therefore opening things to the floor to see what the Gant,
&lt;br&gt;&amp;gt; Gradle, Groovy and Grails communities think about this. &amp;nbsp;Should Gant and
&lt;br&gt;&amp;gt; Gradle compete or should they be realigned and collaborate?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Gant-and-Gradle-tp19810296p19813177.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19810296</id>
	<title>Gant and Gradle</title>
	<published>2008-10-04T02:07:37Z</published>
	<updated>2008-10-04T02:07:37Z</updated>
	<author>
		<name>Russel Winder-4</name>
	</author>
	<content type="html">Please excuse the very wide initial circulation of this, but I want to
&lt;br&gt;make sure people are aware that there is a debate that might affect
&lt;br&gt;them. &amp;nbsp;I suspect the best place for the debate is the Gant Users email
&lt;br&gt;list, so if people could be careful about which list they reply to when
&lt;br&gt;replying then people not interested in the debate will not get flooded
&lt;br&gt;-- i.e. please check carefully where you are sending replies if you
&lt;br&gt;reply to this email. &amp;nbsp;Thanks.
&lt;br&gt;&lt;br&gt;Ever since Hans Dockter realized that he was not going to be able to
&lt;br&gt;build Gradle on Gant, but would have to have a new code base to achieve
&lt;br&gt;his goals, there has been a tension between the roles of Gant and
&lt;br&gt;Gradle. &amp;nbsp;The core technical difference between Gant and Gradle is that
&lt;br&gt;Gant is simply a scripting systems whereas Gradle works with a DAG as do
&lt;br&gt;Make, Ant, Maven, SCons, etc. -- Gant is the odd one out here as a build
&lt;br&gt;framework, it does not build a data structure and reflect on that, it
&lt;br&gt;just executes code.
&lt;br&gt;&lt;br&gt;On and off over the last year (and very much on over the last couple of
&lt;br&gt;weeks) Hans and I have debated (privately) this issue of the tension
&lt;br&gt;between Gant and Gradle. &amp;nbsp;Now though is the right time to open and widen
&lt;br&gt;this debate.
&lt;br&gt;&lt;br&gt;In the Java milieu, Ant and Maven are the dominant build tools, though
&lt;br&gt;as an increasing number of people are realizing, using Groovy instead of
&lt;br&gt;XML as the build specification notation is a Big Win (tm) -- I get a
&lt;br&gt;continuous stream of emails (and I am sure Hans gets analogous emails)
&lt;br&gt;saying &amp;quot;Wow I just tried Gant and it is just so much nicer than Ant as
&lt;br&gt;Groovy is just so much better than XML&amp;quot;. &amp;nbsp;So the core question is how to
&lt;br&gt;make a Groovy-based build framework the dominant player in the Java
&lt;br&gt;world. &amp;nbsp;Should we push both Gant and Gradle independently and see what
&lt;br&gt;happens or should we engineer things a little more so as to have a
&lt;br&gt;greater chance of success?
&lt;br&gt;&lt;br&gt;There are many issues here, a few of which follow:
&lt;br&gt;&lt;br&gt;Gant is just a scripting system and so doesn't really have all the
&lt;br&gt;infrastructure to do many of the things expected of a build framework,
&lt;br&gt;Gradle does. &amp;nbsp;This implies Gradle is a better weapon for getting Groovy
&lt;br&gt;as the major build framework.
&lt;br&gt;&lt;br&gt;Gant is just a single jar and so is very lightweight whereas Gradle has
&lt;br&gt;a lot of dependencies and is relatively heavyweight. &amp;nbsp;Of course Gant is
&lt;br&gt;just a scripting replacement for the XML front end to Ant &amp;nbsp;whereas
&lt;br&gt;Gradle is a complete Ivy-based build framework that supports management
&lt;br&gt;over the whole project lifecycle.
&lt;br&gt;&lt;br&gt;People are increasingly asking for changes to Gant that can be achieved
&lt;br&gt;in a way, but really need DAG support which is already handled by
&lt;br&gt;Gradle.
&lt;br&gt;&lt;br&gt;Gradle can support many of the Ant task scripting things that Gant does
&lt;br&gt;but Gant is so much more lightweight than Gradle for doing this.
&lt;br&gt;&lt;br&gt;No-one seems to be interested in supporting Gant plugins for Eclipse,
&lt;br&gt;NetBeans or IntelliJ IDEA which is limiting its acceptance where IDEs
&lt;br&gt;are mandatory whereas work is in progress on Gradle plugins -- at least
&lt;br&gt;for Eclipse.
&lt;br&gt;&lt;br&gt;There are many other issues but this will do for the present (to try and
&lt;br&gt;keep this email to some semblance of reasonable length :-) 
&lt;br&gt;&lt;br&gt;Where am I going with this?
&lt;br&gt;&lt;br&gt;I am increasingly of the view that Gant should cease trying to be a
&lt;br&gt;build framework and leave this role to a rapidly evolving Gradle. &amp;nbsp;Gant
&lt;br&gt;should instead reposition itself as a lightweight, embeddable Ant task
&lt;br&gt;scripting system. &amp;nbsp;This is exactly how it is used in Grails. &amp;nbsp;Embedding
&lt;br&gt;Gradle to do the Ant task scripting would for me be using too
&lt;br&gt;heavyweight a tool for the task at hand -- though having a Gradle rather
&lt;br&gt;than an Ant build for Grails and indeed Groovy might be a good move.
&lt;br&gt;&lt;br&gt;Recently a number of people have made proposals for change to Gant and
&lt;br&gt;many of these are good proposals (especially the ones accompanied by
&lt;br&gt;patches :-) and I propose to evolve Gant with these proposals where they
&lt;br&gt;fit with Gant being just a lightweight Ant task scripting system. &amp;nbsp;Where
&lt;br&gt;the changes are more to do with Gant becoming an improved build
&lt;br&gt;framework, I am contemplating not making the changes -- especially those
&lt;br&gt;where Gradle already does that which is needed. 
&lt;br&gt;&lt;br&gt;OK, I think this introduces the base issues, and this email is already
&lt;br&gt;long. &amp;nbsp;I am therefore opening things to the floor to see what the Gant,
&lt;br&gt;Gradle, Groovy and Grails communities think about this. &amp;nbsp;Should Gant and
&lt;br&gt;Gradle compete or should they be realigned and collaborate?
&lt;br&gt;&lt;br&gt;Thanks.
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Russel.
&lt;br&gt;====================================================
&lt;br&gt;Dr Russel Winder &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Partner
&lt;br&gt;&lt;br&gt;Concertant LLP &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; t: +44 20 7585 2200, +44 20 7193 9203
&lt;br&gt;41 Buckmaster Road, &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;f: +44 8700 516 084
&lt;br&gt;London SW11 1EN, UK. &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; m: +44 7770 465 077
&lt;br&gt;&lt;br /&gt; &lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;signature.asc&lt;/strong&gt; (196 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19810296/0/signature.asc&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Gant-and-Gradle-tp19810296p19810296.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19809983</id>
	<title>Re: Groovy as arithmetic expression evaluator?</title>
	<published>2008-10-04T01:12:33Z</published>
	<updated>2008-10-04T01:12:33Z</updated>
	<author>
		<name>glaforge</name>
	</author>
	<content type="html">Hi Hamlet,
&lt;br&gt;&lt;br&gt;You can use the technique illustrated at the bottom of this class:
&lt;br&gt;&lt;a href=&quot;http://code.google.com/p/testngroove/source/browse/trunk/src/main/org/codehaus/groovy/testng/GroovyTestNG.java#205&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://code.google.com/p/testngroove/source/browse/trunk/src/main/org/codehaus/groovy/testng/GroovyTestNG.java#205&lt;/a&gt;&lt;br&gt;&lt;br&gt;And use module.addStaticImportClass()
&lt;br&gt;&lt;br&gt;On Sat, Oct 4, 2008 at 4:02 AM, HamletDRC &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19809983&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hamletdrc@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Is there a way to cleanly add a static import for Math other than just
&lt;br&gt;&amp;gt; appending &amp;quot;import static java.lang.Math.*&amp;quot; to the front of the groovyshell
&lt;br&gt;&amp;gt; input?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; glaforge wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Hi Hamlet,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Nice work!
&lt;br&gt;&amp;gt;&amp;gt; I'm wondering if / where we could provide such specific shells /
&lt;br&gt;&amp;gt;&amp;gt; classloaders in Groovy.
&lt;br&gt;&amp;gt;&amp;gt; That could be interesting, and people would be happy to reuse these.
&lt;br&gt;&amp;gt;&amp;gt; A little remark, perhaps you could allow static imports for Math
&lt;br&gt;&amp;gt;&amp;gt; constants? (instead of having to do Math.PI, etc)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Thu, Sep 18, 2008 at 5:40 AM, HamletDRC &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19809983&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hamletdrc@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Alright, thanks for the help everyone. I have a prototype working in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Groovy,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; although for my work I will need to re-write the code in Java tomorrow.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Whatever.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; In case you're interested, the unit tests are here:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; All of the following passes:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(2.9073548971824276E135, shell.evaluate(&amp;quot;((6L / 2f) - 1) **
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 4.5e2&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(-6.816387600233341, shell.evaluate(&amp;quot;10 * Math.sin(15/-20)&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(74.17310622494026,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shell.evaluate(&amp;quot;80*Math.E**(-(+(11++/40)**2))&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(2147483646, shell.evaluate(&amp;quot;Integer.MAX_VALUE - ++2%2&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(6, shell.evaluate(&amp;quot;++(5)&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 &amp;lt; 4 ? 1 : 0&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 != 4 ? 0 : 1 &amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; While the rest fails:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;import java.swing.JLabel;5&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;def x = 5+3;x.toString()&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;new File();Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The source code is here... any tips (especially regarding security) are
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; encouraged:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; In the end, I ended up hooking into the compiler during the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; SEMANTIC_ANALYSIS phase because it seemed to offer my more type
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; information
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; in the AST than when originally walked the AST in the CONVERSION phase.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Does anyone have any use for this ArithmeticShell object? I can clean it
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; up
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; and create a jar/patch or whatever.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks everyone, this was the most enjoyable day I've had in a while.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -- Hamlet D'Arcy
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Jochen Theodorou wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Roshan Dawrani schrieb:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Right. Thanks for pointing that out. I noticed it too in your earlier
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; reply when you called main() like clazz.main(null).
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; However, generally GroovyClassLoader.parseClass() is an approach to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; call
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; groovy code from Java, isn't it? Would such an approach be useful from
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; groovy to groovy also in some scenario?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parseClass is a way to call the compiler and load the compiled classes
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; without setting up a complete environment. Also it offers extended
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; abilities, like hooking into the compilation process itself. GroovyShell
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is more or less a simplified interface to GroovyClassLoader. If this
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; doesn't do what you need, then you need to bother with
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; GroovyClassLoader. It doesn't matter if you are calling from Java or
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Groovy.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Since in thread code, I saw GroovyClassLoader getting used all along, I
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; assumed that calling code is Java. It is just for a little convenience
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that I had written the calling code in groovy. No explicit javac step
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; necessary! Just write and experiment! Very helpful!
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if the code contains a def like in the example from Roshan Dawrani, then
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it sure is Groovy code ;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bye blackdrag
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Jochen &amp;quot;blackdrag&amp;quot; Theodorou
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -----
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hamlet D'Arcy
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; View this message in context:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sent from the groovy - user mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt; Guillaume Laforge
&lt;br&gt;&amp;gt;&amp;gt; Groovy Project Manager
&lt;br&gt;&amp;gt;&amp;gt; G2One, Inc. Vice-President Technology
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -----
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Hamlet D'Arcy
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19808379.html&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19808379.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the groovy - user mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Guillaume Laforge
&lt;br&gt;Groovy Project Manager
&lt;br&gt;G2One, Inc. Vice-President Technology
&lt;br&gt;&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19809983.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19808802</id>
	<title>Re: Groovy as arithmetic expression evaluator?</title>
	<published>2008-10-03T20:47:13Z</published>
	<updated>2008-10-03T20:47:13Z</updated>
	<author>
		<name>Robert Fischer-8</name>
	</author>
	<content type="html">There's the concept of mix-ins, but they're not in general release yet (I think).
&lt;br&gt;&lt;br&gt;~~ Robert.
&lt;br&gt;&lt;br&gt;HamletDRC wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Is there a way to cleanly add a static import for Math other than just
&lt;br&gt;&amp;gt; appending &amp;quot;import static java.lang.Math.*&amp;quot; to the front of the groovyshell
&lt;br&gt;&amp;gt; input? 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; glaforge wrote:
&lt;br&gt;&amp;gt;&amp;gt; Hi Hamlet,
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Nice work!
&lt;br&gt;&amp;gt;&amp;gt; I'm wondering if / where we could provide such specific shells /
&lt;br&gt;&amp;gt;&amp;gt; classloaders in Groovy.
&lt;br&gt;&amp;gt;&amp;gt; That could be interesting, and people would be happy to reuse these.
&lt;br&gt;&amp;gt;&amp;gt; A little remark, perhaps you could allow static imports for Math
&lt;br&gt;&amp;gt;&amp;gt; constants? (instead of having to do Math.PI, etc)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; On Thu, Sep 18, 2008 at 5:40 AM, HamletDRC &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19808802&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;hamletdrc@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Alright, thanks for the help everyone. I have a prototype working in
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Groovy,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; although for my work I will need to re-write the code in Java tomorrow.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Whatever.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; In case you're interested, the unit tests are here:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; All of the following passes:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(2.9073548971824276E135, shell.evaluate(&amp;quot;((6L / 2f) - 1) **
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; 4.5e2&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(-6.816387600233341, shell.evaluate(&amp;quot;10 * Math.sin(15/-20)&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(74.17310622494026,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shell.evaluate(&amp;quot;80*Math.E**(-(+(11++/40)**2))&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(2147483646, shell.evaluate(&amp;quot;Integer.MAX_VALUE - ++2%2&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(6, shell.evaluate(&amp;quot;++(5)&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 &amp;lt; 4 ? 1 : 0&amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 != 4 ? 0 : 1 &amp;quot;))
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; While the rest fails:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;import java.swing.JLabel;5&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;def x = 5+3;x.toString()&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;new File();Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; }
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; The source code is here... any tips (especially regarding security) are
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; encouraged:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; In the end, I ended up hooking into the compiler during the
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; SEMANTIC_ANALYSIS phase because it seemed to offer my more type
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; information
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; in the AST than when originally walked the AST in the CONVERSION phase.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Does anyone have any use for this ArithmeticShell object? I can clean it
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; up
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; and create a jar/patch or whatever.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Thanks everyone, this was the most enjoyable day I've had in a while.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -- Hamlet D'Arcy
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Jochen Theodorou wrote:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Roshan Dawrani schrieb:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Right. Thanks for pointing that out. I noticed it too in your earlier
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; reply when you called main() like clazz.main(null).
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; However, generally GroovyClassLoader.parseClass() is an approach to
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; call
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; groovy code from Java, isn't it? Would such an approach be useful from
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; groovy to groovy also in some scenario?
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; parseClass is a way to call the compiler and load the compiled classes
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; without setting up a complete environment. Also it offers extended
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; abilities, like hooking into the compilation process itself. GroovyShell
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; is more or less a simplified interface to GroovyClassLoader. If this
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; doesn't do what you need, then you need to bother with
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; GroovyClassLoader. It doesn't matter if you are calling from Java or
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Groovy.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Since in thread code, I saw GroovyClassLoader getting used all along, I
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; assumed that calling code is Java. It is just for a little convenience
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; that I had written the calling code in groovy. No explicit javac step
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; necessary! Just write and experiment! Very helpful!
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; if the code contains a def like in the example from Roshan Dawrani, then
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; it sure is Groovy code ;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; bye blackdrag
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; Jochen &amp;quot;blackdrag&amp;quot; Theodorou
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; -----
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Hamlet D'Arcy
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; View this message in context:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Sent from the groovy - user mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; -- 
&lt;br&gt;&amp;gt;&amp;gt; Guillaume Laforge
&lt;br&gt;&amp;gt;&amp;gt; Groovy Project Manager
&lt;br&gt;&amp;gt;&amp;gt; G2One, Inc. Vice-President Technology
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; -----
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Hamlet D'Arcy
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19808802.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19808379</id>
	<title>Re: Groovy as arithmetic expression evaluator?</title>
	<published>2008-10-03T19:02:20Z</published>
	<updated>2008-10-03T19:02:20Z</updated>
	<author>
		<name>HamletDRC</name>
	</author>
	<content type="html">Is there a way to cleanly add a static import for Math other than just appending &amp;quot;import static java.lang.Math.*&amp;quot; to the front of the groovyshell input? 
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;glaforge wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message shrinkable-quote&quot;&gt;Hi Hamlet,
&lt;br&gt;&lt;br&gt;Nice work!
&lt;br&gt;I'm wondering if / where we could provide such specific shells /
&lt;br&gt;classloaders in Groovy.
&lt;br&gt;That could be interesting, and people would be happy to reuse these.
&lt;br&gt;A little remark, perhaps you could allow static imports for Math
&lt;br&gt;constants? (instead of having to do Math.PI, etc)
&lt;br&gt;&lt;br&gt;On Thu, Sep 18, 2008 at 5:40 AM, HamletDRC &amp;lt;hamletdrc@gmail.com&amp;gt; wrote:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Alright, thanks for the help everyone. I have a prototype working in Groovy,
&lt;br&gt;&amp;gt; although for my work I will need to re-write the code in Java tomorrow.
&lt;br&gt;&amp;gt; Whatever.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; In case you're interested, the unit tests are here:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/tests/gep/ArithmeticShellTest.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; All of the following passes:
&lt;br&gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt; assertEquals(2.9073548971824276E135, shell.evaluate(&amp;quot;((6L / 2f) - 1) **
&lt;br&gt;&amp;gt; 4.5e2&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(-6.816387600233341, shell.evaluate(&amp;quot;10 * Math.sin(15/-20)&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(74.17310622494026,
&lt;br&gt;&amp;gt; shell.evaluate(&amp;quot;80*Math.E**(-(+(11++/40)**2))&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(2147483646, shell.evaluate(&amp;quot;Integer.MAX_VALUE - ++2%2&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(6, shell.evaluate(&amp;quot;++(5)&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 &amp;lt; 4 ? 1 : 0&amp;quot;))
&lt;br&gt;&amp;gt; assertEquals(0, shell.evaluate(&amp;quot;5 != 4 ? 0 : 1 &amp;quot;))
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; While the rest fails:
&lt;br&gt;&amp;gt; ArithmeticShell shell = new ArithmeticShell()
&lt;br&gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;import java.swing.JLabel;5&amp;quot;)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;def x = 5+3;x.toString()&amp;quot;)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; shouldFail(SecurityException) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;shell.evaluate(&amp;quot;new File();Double.valueOf(\&amp;quot;5\&amp;quot;)&amp;quot;)
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The source code is here... any tips (especially regarding security) are
&lt;br&gt;&amp;gt; encouraged:
&lt;br&gt;&amp;gt; &lt;a href=&quot;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://svn.assembla.com/svn/SampleCode/gep/src/gep/ArithmeticShell.groovy&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; In the end, I ended up hooking into the compiler during the
&lt;br&gt;&amp;gt; SEMANTIC_ANALYSIS phase because it seemed to offer my more type information
&lt;br&gt;&amp;gt; in the AST than when originally walked the AST in the CONVERSION phase.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Does anyone have any use for this ArithmeticShell object? I can clean it up
&lt;br&gt;&amp;gt; and create a jar/patch or whatever.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thanks everyone, this was the most enjoyable day I've had in a while.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -- Hamlet D'Arcy
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Jochen Theodorou wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Roshan Dawrani schrieb:
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Right. Thanks for pointing that out. I noticed it too in your earlier
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; reply when you called main() like clazz.main(null).
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; However, generally GroovyClassLoader.parseClass() is an approach to call
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; groovy code from Java, isn't it? Would such an approach be useful from
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; groovy to groovy also in some scenario?
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; parseClass is a way to call the compiler and load the compiled classes
&lt;br&gt;&amp;gt;&amp;gt; without setting up a complete environment. Also it offers extended
&lt;br&gt;&amp;gt;&amp;gt; abilities, like hooking into the compilation process itself. GroovyShell
&lt;br&gt;&amp;gt;&amp;gt; is more or less a simplified interface to GroovyClassLoader. If this
&lt;br&gt;&amp;gt;&amp;gt; doesn't do what you need, then you need to bother with
&lt;br&gt;&amp;gt;&amp;gt; GroovyClassLoader. It doesn't matter if you are calling from Java or
&lt;br&gt;&amp;gt;&amp;gt; Groovy.
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; Since in thread code, I saw GroovyClassLoader getting used all along, I
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; assumed that calling code is Java. It is just for a little convenience
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; that I had written the calling code in groovy. No explicit javac step
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; necessary! Just write and experiment! Very helpful!
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; if the code contains a def like in the example from Roshan Dawrani, then
&lt;br&gt;&amp;gt;&amp;gt; it sure is Groovy code ;)
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; bye blackdrag
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; --
&lt;br&gt;&amp;gt;&amp;gt; Jochen &amp;quot;blackdrag&amp;quot; Theodorou
&lt;br&gt;&amp;gt;&amp;gt; The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)
&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt; &lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; -----
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; Hamlet D'Arcy
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; --
&lt;br&gt;&amp;gt; View this message in context: &lt;a href=&quot;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&quot; target=&quot;_top&quot;&gt;http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19545385.html&lt;/a&gt;&lt;br&gt;&amp;gt; Sent from the groovy - user mailing list archive at Nabble.com.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Guillaume Laforge
&lt;br&gt;Groovy Project Manager
&lt;br&gt;G2One, Inc. Vice-President Technology
&lt;br&gt;&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
&lt;div class=&quot;signature&quot;&gt;--
&lt;br&gt;Hamlet D'Arcy
&lt;br&gt;&lt;/div&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Groovy-as-arithmetic-expression-evaluator--tp19459935p19808379.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19807894</id>
	<title>Re: Date.format convenience methods</title>
	<published>2008-10-03T17:31:21Z</published>
	<updated>2008-10-03T17:31:21Z</updated>
	<author>
		<name>Tom Nichols</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 7:39 PM, Paul King &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19807894&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;paulk@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; * Getting the time of the first or last second of a day eg input Date,
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; get
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; back same date but with 23:59:59 as the time, or 00:00:00 to get start of
&lt;br&gt;&amp;gt;&amp;gt;&amp;gt; the day
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; Adding or subtracting 1.second doesn't do this?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I think he is referring to something like .midnight()
&lt;br&gt;&amp;gt; which would take a given date and effectively zero off
&lt;br&gt;&amp;gt; hours, minutes and seconds (in the current timezone).
&lt;br&gt;&amp;gt; You could then add or subtract 1.
&lt;/div&gt;&lt;br&gt;I see. &amp;nbsp;I'd still argue cases like this are better suited for a mixin,
&lt;br&gt;or category. &amp;nbsp;It's not too difficult to do with plain
&lt;br&gt;GregorianCalendar either.
&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Date.format-convenience-methods-tp19785349p19807894.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19807460</id>
	<title>Re: Date.format convenience methods</title>
	<published>2008-10-03T16:39:52Z</published>
	<updated>2008-10-03T16:39:52Z</updated>
	<author>
		<name>Paul King</name>
	</author>
	<content type="html">Tom Nichols wrote:
&lt;br&gt;&amp;gt;&amp;gt; * Getting the time of the first or last second of a day eg input Date, get
&lt;br&gt;&amp;gt;&amp;gt; back same date but with 23:59:59 as the time, or 00:00:00 to get start of
&lt;br&gt;&amp;gt;&amp;gt; the day
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Adding or subtracting 1.second doesn't do this?
&lt;br&gt;&lt;br&gt;I think he is referring to something like .midnight()
&lt;br&gt;which would take a given date and effectively zero off
&lt;br&gt;hours, minutes and seconds (in the current timezone).
&lt;br&gt;You could then add or subtract 1.
&lt;br&gt;&lt;br&gt;Paul.
&lt;br&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Date.format-convenience-methods-tp19785349p19807460.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19807141</id>
	<title>Re: Cannot use Map to &quot;extend&quot; a Java inner class</title>
	<published>2008-10-03T16:03:36Z</published>
	<updated>2008-10-03T16:03:36Z</updated>
	<author>
		<name>Paul King</name>
	</author>
	<content type="html">&lt;br&gt;Yes, I have a patch somewhere which at least partially fixes this.
&lt;br&gt;Didn't get time to test it properly, so saved it as a patch locally
&lt;br&gt;before rolling back to work on other things. I'll see if I can find it.
&lt;br&gt;&lt;br&gt;Paul.
&lt;br&gt;&lt;br&gt;Roshan Dawrani wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi,
&lt;br&gt;&amp;gt; The source code that groovy is internally generating for the proxy class 
&lt;br&gt;&amp;gt; (for the map extending the inner class &amp;quot;TestInner.Inner&amp;quot; in the groovy 
&lt;br&gt;&amp;gt; code) is as follows:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt; class TestInner$Inner_groovyProxy extends TestInner$Inner {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; private closureMap
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; TestInner$Inner_groovyProxy(map) {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; super()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; this.closureMap = map
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; java.lang.String debug() { this.@closureMap['debug'] () &amp;nbsp; &amp;nbsp;}
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt; new TestInner$Inner_groovyProxy(map)
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; ---------------------------------------------------------------------------------------------------------
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; And it is giving a compilation error as the name of the class has a &amp;quot;$&amp;quot; 
&lt;br&gt;&amp;gt; symbol in it. If the maps can extend classes/abstract classes to provide 
&lt;br&gt;&amp;gt; the implementation and inner classes need to be supported, then naming 
&lt;br&gt;&amp;gt; of the inner classes needs to be handled appropriately.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; rgds,
&lt;br&gt;&amp;gt; Roshan
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; On Fri, Oct 3, 2008 at 10:55 PM, Mingfai &amp;lt;mingfai.ma 
&lt;br&gt;&amp;gt; &amp;lt;&lt;a href=&quot;http://mingfai.ma&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mingfai.ma&lt;/a&gt;&amp;gt;@gmail.com &amp;lt;&lt;a href=&quot;http://gmail.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gmail.com&lt;/a&gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; tried. it doesn't work, too.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3068&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3068&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; On Sat, Oct 4, 2008 at 1:07 AM, Guillaume Laforge
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19807141&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt; &amp;lt;mailto:&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19807141&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; At first sight, it looks like a bug, worth a JIRA.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; I haven't tried, but perhaps a workaround could be to try
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; aliasing the
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; import of that inner class with import foo.TestInner.Inner as
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MyInner,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; and do def inner1 = [debug: { &amp;quot;outer debug 1&amp;quot; }] as MyInner.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Dunno if
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; that works.
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; On Fri, Oct 3, 2008 at 7:03 PM, Mingfai &amp;lt;mingfai.ma
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;&lt;a href=&quot;http://mingfai.ma&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mingfai.ma&lt;/a&gt;&amp;gt;@gmail.com &amp;lt;&lt;a href=&quot;http://gmail.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://gmail.com&lt;/a&gt;&amp;gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; i'm not sure if using a Map to &amp;quot;extend&amp;quot; a Java class is an
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; officially
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; supported feature anyway. The doc only say it can be used to
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; implement
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; interface.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; Say, for the following Java:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; public class TestInner {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; &amp;nbsp; &amp;nbsp;public String debug(){ return &amp;quot;outer debug&amp;quot;; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; &amp;nbsp; &amp;nbsp; public class Inner {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String debug(){ return &amp;quot;inner debug&amp;quot;; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; The following does work:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; def inner1 = ['debug':{return &amp;quot;outer debug 1&amp;quot;}] as TestInner
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; println inner1.debug()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; But not :
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; def inner2 = ['debug':{return &amp;quot;inner debug 1&amp;quot;}] as
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TestInner.Inner
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; println inner2.debug()
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; There is compilation error.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; Caught:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; casting map to TestInner$Inner, Reason: Error creating proxy:
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; startup
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; failed, Script1.groovy: 1: unexpected token: $ @ line 1,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; column 16.
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; 1 error
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; JIRA it as bug or request for new feature? :-)
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; regards,
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt; mingfai
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;gt;
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; --
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Guillaume Laforge
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Groovy Project Manager
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; G2One, Inc. Vice-President Technology
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ---------------------------------------------------------------------
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; To unsubscribe from this list, please visit:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; 
&lt;/div&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Cannot-use-Map-to-%22extend%22-a-Java-inner-class-tp19801928p19807141.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19802844</id>
	<title>Re: Closure does not have scope precedent over local method?</title>
	<published>2008-10-03T11:00:50Z</published>
	<updated>2008-10-03T11:00:50Z</updated>
	<author>
		<name>Roshan Dawrani</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Hi,&lt;br&gt;I have now opened an issue for the issue relating to a closure parameter not having scope precedent over local method - &lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3069&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3069&lt;/a&gt;&lt;br&gt;
&lt;br&gt;rgds,&lt;br&gt;Roshan&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Oct 2, 2008 at 9:30 AM, Roshan Dawrani &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19802844&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;roshandawrani@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
&lt;div dir=&quot;ltr&quot;&gt;Hi Tom,&lt;br&gt;Since you originally raised this issue, wanted to check with you if you would like to fill an issue for it or you would like me to fill one?&lt;br&gt;rgds,&lt;br&gt;&lt;font color=&quot;#888888&quot;&gt;Roshan&lt;/font&gt;&lt;div&gt;&lt;div&gt;
&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Thu, Oct 2, 2008 at 12:04 AM, Jochen Theodorou &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19802844&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;blackdrag@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;Ladislav Thon schrieb:&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt; So instead I would like other users here telling me what they&lt;br&gt;
 &amp;nbsp; &amp;nbsp;expect when&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt; they see code like:&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt; [...]&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;private String selectSql() {return &amp;#39;local method&amp;#39;}&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp;public String returnSql(String id, Closure selectSql) {&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return &amp;quot;${selectSql()}&amp;quot;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp;}&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt;&lt;br&gt;
 &amp;nbsp; &amp;nbsp; &amp;gt; so what do others think?&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;Intuitively, I expected that the closure would have been called.&lt;br&gt;
 &amp;nbsp; &amp;nbsp;Whereas if I wanted to call the method, I would haven had to&lt;br&gt;
 &amp;nbsp; &amp;nbsp;disambiguate using this.selectSql().&lt;br&gt;
&lt;br&gt;
Agree. At least the behavior is consistent with a direct call return selectSql(), but really counter-intuitive. All common precedence resolution strategies I can think of now, both lexical (static) or dynamic, would resolve to the parameter. Don&amp;#39;t know anything about implementation of Groovy (although I would like to play with the source code someday, as it interests me quite a lot).&lt;br&gt;


&lt;/blockquote&gt;
&lt;br&gt;&lt;/div&gt;&lt;/div&gt;
since we have at last 3 pro and no con atm I suggest that you or the original poster fill an issue for it... if it is not filled yet... I am in the process of catching up with my emails, so maybe there is one already&lt;div&gt;

&lt;br&gt;
&lt;br&gt;
bye blackdrag&lt;br&gt;
&lt;br&gt;
-- &lt;br&gt;
Jochen &amp;quot;blackdrag&amp;quot; Theodorou&lt;br&gt;
The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)&lt;br&gt;
&lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;
&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Closure-does-not-have-scope-precedent-over-local-method--tp19724860p19802844.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19802415</id>
	<title>Re: Cannot use Map to &quot;extend&quot; a Java inner class</title>
	<published>2008-10-03T10:34:05Z</published>
	<updated>2008-10-03T10:34:05Z</updated>
	<author>
		<name>Roshan Dawrani</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;Hi,&lt;br&gt;The source code that groovy is internally generating for the proxy class (for the map extending the inner class &amp;quot;TestInner.Inner&amp;quot; in the groovy code) is as follows:&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------------------------------------------&lt;br&gt;
class TestInner$Inner_groovyProxy extends TestInner$Inner {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private closureMap&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; TestInner$Inner_groovyProxy(map) {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; super()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.closureMap = map&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; java.lang.String debug() { this.@closureMap[&amp;#39;debug&amp;#39;] ()&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;
}&lt;br&gt;new TestInner$Inner_groovyProxy(map)&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------------------------------------------&lt;br&gt;&lt;br&gt;And it is giving a compilation error as the name of the class has a &amp;quot;$&amp;quot; symbol in it. If the maps can extend classes/abstract classes to provide the implementation and inner classes need to be supported, then naming of the inner classes needs to be handled appropriately.&lt;br&gt;
&lt;br&gt;rgds,&lt;br&gt;Roshan&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Fri, Oct 3, 2008 at 10:55 PM, Mingfai &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://mingfai.ma&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mingfai.ma&lt;/a&gt;@&lt;a href=&quot;http://gmail.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;gmail.com&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;&lt;div dir=&quot;ltr&quot;&gt;tried. it doesn&amp;#39;t work, too.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3068&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3068&lt;/a&gt;&lt;div&gt;
&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sat, Oct 4, 2008 at 1:07 AM, Guillaume Laforge &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19802415&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;

&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;At first sight, it looks like a bug, worth a JIRA.&lt;br&gt;
I haven&amp;#39;t tried, but perhaps a workaround could be to try aliasing the&lt;br&gt;
import of that inner class with import foo.TestInner.Inner as MyInner,&lt;br&gt;
and do def inner1 = [debug: { &amp;quot;outer debug 1&amp;quot; }] as MyInner. Dunno if&lt;br&gt;
that works.&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;
On Fri, Oct 3, 2008 at 7:03 PM, Mingfai &amp;lt;&lt;a href=&quot;http://mingfai.ma&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;mingfai.ma&lt;/a&gt;@&lt;a href=&quot;http://gmail.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;gmail.com&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt; i&amp;#39;m not sure if using a Map to &amp;quot;extend&amp;quot; a Java class is an officially&lt;br&gt;
&amp;gt; supported feature anyway. The doc only say it can be used to implement&lt;br&gt;
&amp;gt; interface.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Say, for the following Java:&lt;br&gt;
&amp;gt; public class TestInner {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;public String debug(){ return &amp;quot;outer debug&amp;quot;; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; public class Inner {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String debug(){ return &amp;quot;inner debug&amp;quot;; }&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; }&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The following does work:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; def inner1 = [&amp;#39;debug&amp;#39;:{return &amp;quot;outer debug 1&amp;quot;}] as TestInner&lt;br&gt;
&amp;gt; println inner1.debug()&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But not :&lt;br&gt;
&amp;gt; def inner2 = [&amp;#39;debug&amp;#39;:{return &amp;quot;inner debug 1&amp;quot;}] as TestInner.Inner&lt;br&gt;
&amp;gt; println inner2.debug()&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; There is compilation error.&lt;br&gt;
&amp;gt; Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error&lt;br&gt;
&amp;gt; casting map to TestInner$Inner, Reason: Error creating proxy: startup&lt;br&gt;
&amp;gt; failed, Script1.groovy: 1: unexpected token: $ @ line 1, column 16.&lt;br&gt;
&amp;gt; 1 error&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; JIRA it as bug or request for new feature? :-)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; regards,&lt;br&gt;
&amp;gt; mingfai&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;--&lt;br&gt;
Guillaume Laforge&lt;br&gt;
Groovy Project Manager&lt;br&gt;
G2One, Inc. Vice-President Technology&lt;br&gt;
&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Cannot-use-Map-to-%22extend%22-a-Java-inner-class-tp19801928p19802415.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19802312</id>
	<title>Re: Cannot use Map to &quot;extend&quot; a Java inner class</title>
	<published>2008-10-03T10:25:55Z</published>
	<updated>2008-10-03T10:25:55Z</updated>
	<author>
		<name>Mingfai</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;tried. it doesn&amp;#39;t work, too.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;http://jira.codehaus.org/browse/GROOVY-3068&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://jira.codehaus.org/browse/GROOVY-3068&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;div class=&quot;gmail_quote&quot;&gt;On Sat, Oct 4, 2008 at 1:07 AM, Guillaume Laforge &lt;span dir=&quot;ltr&quot;&gt;&amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19802312&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;glaforge@...&lt;/a&gt;&amp;gt;&lt;/span&gt; wrote:&lt;br&gt;
&lt;blockquote class=&quot;gmail_quote&quot; style=&quot;border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;&quot;&gt;At first sight, it looks like a bug, worth a JIRA.&lt;br&gt;
I haven&amp;#39;t tried, but perhaps a workaround could be to try aliasing the&lt;br&gt;
import of that inner class with import foo.TestInner.Inner as MyInner,&lt;br&gt;
and do def inner1 = [debug: { &amp;quot;outer debug 1&amp;quot; }] as MyInner. Dunno if&lt;br&gt;
that works.&lt;br&gt;
&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div class=&quot;Wj3C7c&quot;&gt;&lt;br&gt;
On Fri, Oct 3, 2008 at 7:03 PM, Mingfai &amp;lt;&lt;a href=&quot;http://mingfai.ma&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;mingfai.ma&lt;/a&gt;@&lt;a href=&quot;http://gmail.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;gmail.com&lt;/a&gt;&amp;gt; wrote:&lt;br&gt;
&amp;gt; i&amp;#39;m not sure if using a Map to &amp;quot;extend&amp;quot; a Java class is an officially&lt;br&gt;
&amp;gt; supported feature anyway. The doc only say it can be used to implement&lt;br&gt;
&amp;gt; interface.&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; Say, for the following Java:&lt;br&gt;
&amp;gt; public class TestInner {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp;public String debug(){ return &amp;quot;outer debug&amp;quot;; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; public class Inner {&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String debug(){ return &amp;quot;inner debug&amp;quot;; }&lt;br&gt;
&amp;gt; &amp;nbsp; &amp;nbsp; }&lt;br&gt;
&amp;gt; }&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; The following does work:&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; def inner1 = [&amp;#39;debug&amp;#39;:{return &amp;quot;outer debug 1&amp;quot;}] as TestInner&lt;br&gt;
&amp;gt; println inner1.debug()&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; But not :&lt;br&gt;
&amp;gt; def inner2 = [&amp;#39;debug&amp;#39;:{return &amp;quot;inner debug 1&amp;quot;}] as TestInner.Inner&lt;br&gt;
&amp;gt; println inner2.debug()&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; There is compilation error.&lt;br&gt;
&amp;gt; Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error&lt;br&gt;
&amp;gt; casting map to TestInner$Inner, Reason: Error creating proxy: startup&lt;br&gt;
&amp;gt; failed, Script1.groovy: 1: unexpected token: $ @ line 1, column 16.&lt;br&gt;
&amp;gt; 1 error&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; JIRA it as bug or request for new feature? :-)&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt; regards,&lt;br&gt;
&amp;gt; mingfai&lt;br&gt;
&amp;gt;&lt;br&gt;
&amp;gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/div&gt;&lt;/div&gt;--&lt;br&gt;
Guillaume Laforge&lt;br&gt;
Groovy Project Manager&lt;br&gt;
G2One, Inc. Vice-President Technology&lt;br&gt;
&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
---------------------------------------------------------------------&lt;br&gt;
To unsubscribe from this list, please visit:&lt;br&gt;
&lt;br&gt;
 &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_blank&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;/blockquote&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Cannot-use-Map-to-%22extend%22-a-Java-inner-class-tp19801928p19802312.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19802018</id>
	<title>Re: Cannot use Map to &quot;extend&quot; a Java inner class</title>
	<published>2008-10-03T10:07:56Z</published>
	<updated>2008-10-03T10:07:56Z</updated>
	<author>
		<name>glaforge</name>
	</author>
	<content type="html">At first sight, it looks like a bug, worth a JIRA.
&lt;br&gt;I haven't tried, but perhaps a workaround could be to try aliasing the
&lt;br&gt;import of that inner class with import foo.TestInner.Inner as MyInner,
&lt;br&gt;and do def inner1 = [debug: { &amp;quot;outer debug 1&amp;quot; }] as MyInner. Dunno if
&lt;br&gt;that works.
&lt;br&gt;&lt;br&gt;On Fri, Oct 3, 2008 at 7:03 PM, Mingfai &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19802018&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;mingfai.ma@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; i'm not sure if using a Map to &amp;quot;extend&amp;quot; a Java class is an officially
&lt;br&gt;&amp;gt; supported feature anyway. The doc only say it can be used to implement
&lt;br&gt;&amp;gt; interface.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Say, for the following Java:
&lt;br&gt;&amp;gt; public class TestInner {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;public String debug(){ return &amp;quot;outer debug&amp;quot;; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; public class Inner {
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public String debug(){ return &amp;quot;inner debug&amp;quot;; }
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; }
&lt;br&gt;&amp;gt; }
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The following does work:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; def inner1 = ['debug':{return &amp;quot;outer debug 1&amp;quot;}] as TestInner
&lt;br&gt;&amp;gt; println inner1.debug()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; But not :
&lt;br&gt;&amp;gt; def inner2 = ['debug':{return &amp;quot;inner debug 1&amp;quot;}] as TestInner.Inner
&lt;br&gt;&amp;gt; println inner2.debug()
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; There is compilation error.
&lt;br&gt;&amp;gt; Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error
&lt;br&gt;&amp;gt; casting map to TestInner$Inner, Reason: Error creating proxy: startup
&lt;br&gt;&amp;gt; failed, Script1.groovy: 1: unexpected token: $ @ line 1, column 16.
&lt;br&gt;&amp;gt; 1 error
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; JIRA it as bug or request for new feature? :-)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; regards,
&lt;br&gt;&amp;gt; mingfai
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Guillaume Laforge
&lt;br&gt;Groovy Project Manager
&lt;br&gt;G2One, Inc. Vice-President Technology
&lt;br&gt;&lt;a href=&quot;http://www.g2one.com&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.codehaus.org/manage_email&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Cannot-use-Map-to-%22extend%22-a-Java-inner-class-tp19801928p19802018.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19801928</id>
	<title>Cannot use Map to &quot;extend&quot; a Java inner class</title>
	<published>2008-10-03T10:03:55Z</published>
	<updated>2008-10-03T10:03:55Z</updated>
	<author>
		<name>Mingfai</name>
	</author>
	<content type="html">&lt;div dir=&quot;ltr&quot;&gt;i&amp;#39;m not sure if using a Map to &amp;quot;extend&amp;quot; a Java class is an officially supported feature anyway. The doc only say it can be used to implement interface.&lt;br&gt;&lt;br&gt;Say, for the following Java:&lt;br&gt;public class TestInner {&lt;br&gt;
&amp;nbsp;&amp;nbsp; public String debug(){ return &amp;quot;outer debug&amp;quot;; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Inner {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public String debug(){ return &amp;quot;inner debug&amp;quot;; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;br&gt;&lt;br&gt;The following does work:&lt;br&gt;&lt;br&gt;def inner1 = [&amp;#39;debug&amp;#39;:{return &amp;quot;outer debug 1&amp;quot;}] as TestInner&lt;br&gt;
println inner1.debug()&lt;br&gt;&lt;br&gt;But not :&lt;br&gt;def inner2 = [&amp;#39;debug&amp;#39;:{return &amp;quot;inner debug 1&amp;quot;}] as TestInner.Inner&lt;br&gt;println inner2.debug()&lt;br&gt;&lt;br&gt;There is compilation error. &lt;br&gt;Caught: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Error casting map to TestInner$Inner, Reason: Error creating proxy: startup failed, Script1.groovy: 1: unexpected token: $ @ line 1, column 16.&lt;br&gt;
1 error&lt;br&gt;&lt;br&gt;JIRA it as bug or request for new feature? :-)&lt;br&gt;&lt;br&gt;regards,&lt;br&gt;mingfai&lt;br&gt;&lt;br&gt;&lt;/div&gt;
</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Cannot-use-Map-to-%22extend%22-a-Java-inner-class-tp19801928p19801928.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19801400</id>
	<title>Re: London GGUG meeting last evening -- Groovy strategy for parallelism</title>
	<published>2008-10-03T09:36:08Z</published>
	<updated>2008-10-03T09:36:08Z</updated>
	<author>
		<name>Andres Almiray</name>
	</author>
	<content type="html">&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Peter Ledbrook-2 wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message&quot;&gt;I've been thinking about this, and actually if Groovy were to become a
&lt;br&gt;real contender for writing Swing applications, then I think the higher
&lt;br&gt;level abstractions would be worth the effort. There's nothing like a
&lt;br&gt;Swing application for threading issues :) Although such things may be
&lt;br&gt;solved with something like the Groovy Actors library rather than
&lt;br&gt;JSR166y.
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
We do have some abstractions provided by Swing(X)Builder already (edt, doLater, doOutside, withworker), but I agree that an actor based library would boost concurrent programming, not just for Swing apps :-)
&lt;br&gt;&lt;br&gt;&lt;blockquote class=&quot;quote light-black dark-border-color&quot;&gt;&lt;div class=&quot;quote light-border-color&quot;&gt;
&lt;div class=&quot;quote-author&quot; style=&quot;font-weight: bold;&quot;&gt;Peter Ledbrook-2 wrote:&lt;/div&gt;
&lt;div class=&quot;quote-message&quot;&gt;Also, I don't know what the results of JSR166y look like, but if it's
&lt;br&gt;not particularly easy to use then &amp;quot;easy parallelism with Groovy&amp;quot; would
&lt;br&gt;be a good selling point in general.
&lt;/div&gt;
&lt;/div&gt;&lt;/blockquote&gt;
See here for some examples &lt;a href=&quot;http://groovy.dzone.com/news/concurrency-jsr-166y-meets-gro&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.dzone.com/news/concurrency-jsr-166y-meets-gro&lt;/a&gt;&lt;br&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/London-GGUG-meeting-last-evening----Groovy-strategy-for-parallelism-tp19773981p19801400.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19801082</id>
	<title>Re: closure issue in GroovyTestCase</title>
	<published>2008-10-03T09:15:12Z</published>
	<updated>2008-10-03T09:15:12Z</updated>
	<author>
		<name>Jochen Theodorou</name>
	</author>
	<content type="html">Haotian Sun schrieb:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; Hi guys,
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; I've got a junit test class which extends GroovyTestCase, when the class 
&lt;br&gt;&amp;gt; involves some Groovy class/script which generate closures classes, the 
&lt;br&gt;&amp;gt; test will fail along with the message like following:
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; junit.framework.AssertionFailedError: Class MyTest_closure1 has no 
&lt;br&gt;&amp;gt; public constructor TestCase(String name) or TestCase()
&lt;br&gt;&amp;gt; 
&lt;br&gt;&amp;gt; Does anyone have idea to fix this?
&lt;/div&gt;&lt;br&gt;you tried to execute the closure classas junit test. You should not do 
&lt;br&gt;that. Look at where you collect the tests and how you do that and fix 
&lt;br&gt;that part ;)
&lt;br&gt;&lt;br&gt;bye blackdrag
&lt;br&gt;&lt;br&gt;-- 
&lt;br&gt;Jochen &amp;quot;blackdrag&amp;quot; Theodorou
&lt;br&gt;The Groovy Project Tech Lead (&lt;a href=&quot;http://groovy.codehaus.org&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://groovy.codehaus.org&lt;/a&gt;)
&lt;br&gt;&lt;a href=&quot;http://blackdragsview.blogspot.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://blackdragsview.blogspot.com/&lt;/a&gt;&lt;br&gt;&lt;a href=&quot;http://www.g2one.com/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.g2one.com/&lt;/a&gt;&lt;br&gt;&lt;br&gt;---------------------------------------------------------------------
&lt;br&gt;To unsubscribe from this list, please visit:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://xircles.codehaus.org/manage_email&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://xircles.co