Jakob Praher | 1 May 2004 11:07
Picon
Favicon

[groovy-dev] ducktyping

hi all,

what kind of type checking model are you considering for groovys dynamic
nature?

I really like the idea of rubys ducktyping model[1] described by the
pragmatic programmers.

For instance, in ruby there are 2 types of methods for type conversion:

to_i       - a weak type conversion
to_int     - says this is actually a integer type

to_s       - a weak type conversion - like toString in java
to_str     - says this is actually a string type

and for instance a ruby File constructor, which can consume an int or a
string, looks like

def File.new( file, *args )
  # open from file descriptor
  if file.respond_to?( :to_int )   # is it an integer type
     IO.new( file.to_int, *args )
  else
  #open from string name
     name = file.to_str
     # ....   
  end
end

(Continue reading)

Krishnan Venkatachalam | 2 May 2004 20:30
Favicon

[groovy-dev] (no subject)

Hello Troy,
I  got your reference from the web.Actually I am facing issues when trying to connect to CVS from Eclipse.

Both the CVS server and Eclipse reside on the my m/c which is on Windows XP.
When I try to add a Repository thru Eclipse I get  the foll error:
Errror validating location.Cannot connect to host.I'm not sure of the values for username,password and Connection type to be entered.Shouldn't the username and pasword be the same as your Windows XP login?

I would gretaly appreciate if you could help me out.

Thanks
Krishnan 



Krishnan Venkatachalam | 2 May 2004 20:30
Favicon

[groovy-dev] Problems with CVS.

Hello Troy,
I  got your reference from the web.Actually I am facing issues when trying to connect to CVS from Eclipse.

Both the CVS server and Eclipse reside on the my m/c which is on Windows XP.
When I try to add a Repository thru Eclipse I get  the foll error:
Errror validating location.Cannot connect to host.I'm not sure of the values for username,password and Connection type to be entered.Shouldn't the username and pasword be the same as your Windows XP login?

I would gretaly appreciate if you could help me out.

Thanks
Krishnan 



jastrachan | 3 May 2004 10:39
Picon

Re: [groovy-dev] Problems with CVS.


On 2 May 2004, at 19:30, Krishnan Venkatachalam wrote:

> Hello Troy,
> I  got your reference from the web.Actually I am facing issues when 
> trying to connect to CVS from Eclipse.
>
> Both the CVS server and Eclipse reside on the my m/c which is on 
> Windows XP.
> When I try to add a Repository thru Eclipse I get  the foll error:
> Errror validating location.Cannot connect to host.I'm not sure of the 
> values for username,password and Connection type to be 
> entered.Shouldn't the username and pasword be the same as your Windows 
> XP login?
>
> I would gretaly appreciate if you could help me out.

Connection details are here...

http://groovy.codehaus.org/cvs-usage.html

try using the anonymous user (with no password) for read-only access.

James
-------
http://radio.weblogs.com/0112098/
Troy Heninger | 3 May 2004 15:43
Picon

RE: [groovy-dev] Problems with CVS.

Sorry, I was never able to connect successfully with my assigned un/pw.  I
could connect anonymously, however, using the instructions on the Groovy
website.

Troy
-----Original Message-----
From: groovy-dev-admin@...
[mailto:groovy-dev-admin@...] On Behalf Of Krishnan
Venkatachalam
Sent: Sunday, May 02, 2004 12:31 PM
To: groovy-dev@...
Subject: [groovy-dev] Problems with CVS.

Hello Troy,
I  got your reference from the web.Actually I am facing issues when trying
to connect to CVS from Eclipse.

Both the CVS server and Eclipse reside on the my m/c which is on Windows XP.
When I try to add a Repository thru Eclipse I get  the foll error:
Errror validating location.Cannot connect to host.I'm not sure of the values
for username,password and Connection type to be entered.Shouldn't the
username and pasword be the same as your Windows XP login?

I would gretaly appreciate if you could help me out.

Thanks
Krishnan  

 <http://clients.rediff.com/signature/track_sig.asp>  
Attachment (winmail.dat): application/ms-tnef, 3628 bytes
nielinjie | 5 May 2004 12:29
Favicon

[groovy-dev] 转发: how to embed groovy in java sdk 1.5(beta 1)

xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

 

I write a very simple testing class to test embedding groovy in java like this. It works very well when I use jdk 1.4.x. But when I use jdk 1.5 (beta), exceptions are thrown.

My application needs some new feature in jdk 1.5. and I want to use groovy in this application to do some simple task, just like to run this script: “result=(data===event.getdate()) “, I will set data and event in my java code, and bind these variables to groovy shell (these variables’ type is very simple, does not use 1.5’s new feature, these types can be compiled in 1.4. In another word, all classes interact with groovy can be compiled in 1.4, these classes only return some primary type variables to classes which need 1.5), after run this script, I want read the “result” in my java code. I know how to implement this when use jdk 1.4.x, but how can I make groovy’s peace with jdk1.5.

Thanks.

 

public class Main {

    public static void main(String[] arg) {

        Binding binding = new Binding();

        binding.setVariable("foo", new Integer(2));

        GroovyShell shell = new GroovyShell(binding);

        Object value=null;

        try {

            value = shell.evaluate("println 'Hello World!'; x = 123; return foo * 10");

        }catch(Exception e){

            e.printStackTrace();

        }

        System.out.println("value = " + value);

        System.out.println("binding = " + binding);

        //assert value.equals(new Integer(20));

        //assert binding.getVariable("x").equals(new Integer(123))

    }

}

 

java.lang.ClassFormatError: Illegal method name "access+000"

         at java.lang.ClassLoader.defineClass1(Native Method)

         at java.lang.ClassLoader.defineClass(ClassLoader.java:604)

         at java.lang.ClassLoader.defineClass(ClassLoader.java:448)

         at groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:266)

         at groovy.lang.MetaClassRegistry.loadClass(MetaClassRegistry.java:122)

         at groovy.lang.MetaClass.loadReflectorClass(MetaClass.java:1451)

         at groovy.lang.MetaClass.loadReflector(MetaClass.java:1437)

         at groovy.lang.MetaClass.generateReflector(MetaClass.java:1390)

         at groovy.lang.MetaClass.checkInitialised(MetaClass.java:1343)

         at groovy.lang.MetaClassRegistry.checkInitialised(MetaClassRegistry.java:139)

         at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:84)

         at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:72)

         at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:83)

         at org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:82)

         at groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:61)

         at groovy.lang.Binding.<init>(Binding.java:62)

         at Main.main(Main.java:14)

         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

         at java.lang.reflect.Method.invoke(Method.java:494)

         at com.intellij.rt.execution.application.AppMain.main(Unknown Source)

clint | 5 May 2004 15:39
Favicon
Gravatar

Re: [groovy-dev] ת·¢: how to embed groovy in java sdk 1.5(beta 1)

It looks like you're using the beta 4 release of Groovy.  I reported this 
issue against that release and it has been fixed:

http://jira.codehaus.org/secure/ViewIssue.jspa?key=GROOVY-280

You can download an updated version of the groovy jar file and patch your 
installation.  You just need to drop the jar into the two places it appears in 
the directory structure.  Make sure to rename the old jar to something that 
doesn't end in ".jar" (".jar-SAVE" works).

Here's a link to the latest jar builds:

http://dist.codehaus.org/groovy/jars/

-Clint

Quoting nielinjie <nielinjie@...>:

>  
> 
> I write a very simple testing class to test embedding groovy in java like
> this. It works very well when I use jdk 1.4.x. But when I use jdk 1.5
> (beta), exceptions are thrown. 
> 
> My application needs some new feature in jdk 1.5. and I want to use groovy
> in this application to do some simple task, just like to run this script:
> ¡°result=(data===event.getdate()) ¡°, I will set data and event in my java
> code, and bind these variables to groovy shell (these variables¡¯ type is
> very simple, does not use 1.5¡¯s new feature, these types can be compiled in
> 1.4. In another word, all classes interact with groovy can be compiled in 1.
> 4, these classes only return some primary type variables to classes which
> need 1.5), after run this script, I want read the ¡°result¡± in my java
> code. I know how to implement this when use jdk 1.4.x, but how can I make
> groovy¡¯s peace with jdk1.5. 
> 
> Thanks.
> 
>  
> 
> public class Main {
> 
>     public static void main(String[] arg) {
> 
>         Binding binding = new Binding();
> 
>         binding.setVariable("foo", new Integer(2));
> 
>         GroovyShell shell = new GroovyShell(binding);
> 
>         Object value=null;
> 
>         try {
> 
>             value = shell.evaluate("println 'Hello World!'; x = 123; return
> foo * 10");
> 
>         }catch(Exception e){
> 
>             e.printStackTrace();
> 
>         }
> 
>         System.out.println("value = " + value);
> 
>         System.out.println("binding = " + binding);
> 
>         //assert value.equals(new Integer(20));
> 
>         //assert binding.getVariable("x").equals(new Integer(123))
> 
>     }
> 
> }
> 
>  
> 
> java.lang.ClassFormatError: Illegal method name "access+000"
> 
>          at java.lang.ClassLoader.defineClass1(Native Method)
> 
>          at java.lang.ClassLoader.defineClass(ClassLoader.java:604)
> 
>          at java.lang.ClassLoader.defineClass(ClassLoader.java:448)
> 
>          at
> groovy.lang.GroovyClassLoader.loadClass(GroovyClassLoader.java:266)
> 
>          at
> groovy.lang.MetaClassRegistry.loadClass(MetaClassRegistry.java:122)
> 
>          at groovy.lang.MetaClass.loadReflectorClass(MetaClass.java:1451)
> 
>          at groovy.lang.MetaClass.loadReflector(MetaClass.java:1437)
> 
>          at groovy.lang.MetaClass.generateReflector(MetaClass.java:1390)
> 
>          at groovy.lang.MetaClass.checkInitialised(MetaClass.java:1343)
> 
>          at
> groovy.lang.MetaClassRegistry.checkInitialised(MetaClassRegistry.java:139)
> 
>          at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:84)
> 
>          at groovy.lang.MetaClassRegistry.<init>(MetaClassRegistry.java:72)
> 
>          at org.codehaus.groovy.runtime.Invoker.<init>(Invoker.java:83)
> 
>          at
> org.codehaus.groovy.runtime.InvokerHelper.<clinit>(InvokerHelper.java:82)
> 
>          at
> groovy.lang.GroovyObjectSupport.<init>(GroovyObjectSupport.java:61)
> 
>          at groovy.lang.Binding.<init>(Binding.java:62)
> 
>          at Main.main(Main.java:14)
> 
>          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 
>          at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39
> )
> 
>          at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl
> .java:25)
> 
>          at java.lang.reflect.Method.invoke(Method.java:494)
> 
>          at com.intellij.rt.execution.application.AppMain.main(Unknown
> Source)
> 
> 
Kevin Jones | 5 May 2004 17:50

[groovy-dev] Exception thrown when logging enabled

I'm using the antbuilder and have code that looks like this

public static main(args){  

    ant = new AntBuilder();
    ant.copy(todir: args[1], overwrite: true){
        fileset(dir: args[1]){
                include(name: args[2])
            }
    }
}

This works fine unless I set the logging level to FINE (or higher) in
logging.properties, then I get

05-May-2004 16:39:25 groovy.util.AntBuilder createNode
FINE: Created nested property tag: fileset
Caught: No directory specified for fileset.
No directory specified for fileset.
        at
org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileS
et.java:345)
        at
org.apache.tools.ant.types.AbstractFileSet.toString(AbstractFileSet.java:671
)
        at java.lang.String.valueOf(String.java:2584)

and the rest of the stack trace

This is under JDK 1.5 (b48) and a fairly recent groovy build (post beta4,
built from CVS)

Bizarre!

Kevin Jones
http://kevinj.develop.com 
Rod Cope | 6 May 2004 20:19

[groovy-dev] Anonymous CVS access problems

Ever since the CVS changeover, I haven't been able to get anonymous CVS
access.  I gave it a coupla weeks to stabilize, but it still doesn't work.

I've tried about 10 times to follow the cvs-usage page details, but I always
get something like this from any CVS client in response to a checkout
attempt:

  checkout -A -P groovy/groovy-core 
   unrecognized request `Case '
  Command Aborted.

I've tried multiple clients, so I doubt it's a client issue unless I'm doing
something stupid in every one of them.

Any ideas?  Can someone try it real quick and let me know if it's just me?

Thanks,
Rod
Guillaume Laforge | 6 May 2004 20:32
Picon
Favicon

RE: [groovy-dev] Anonymous CVS access problems

>Ever since the CVS changeover, I haven't been able to get anonymous CVS
>access.  I gave it a coupla weeks to stabilize, but it still doesn't work.
>
>Any ideas?  Can someone try it real quick and let me know if it's just me?

What address do you use ? This one should work (it works for me) : 

:pserver:anonymous@...:/home/projects/groovy/scm

--
Guillaume Laforge
http://glaforge.free.fr/weblog/index.php?catid=1 

Gmane