Gavin Grover | 1 Jul 2012 11:15
Picon
Favicon

Re: [groovy-user] Groovy 3 and the equality of char and a String of length 1

----- Original Message -----

> From: Jochen Theodorou <blackdrag <at> gmx.org>

> what I don't want to allow anymore is

> def c = stringOfLength1

> 
> thoughts?

All of the following work in Groovy 2.0.

  def c="z"
  assert c == "z"
  assert c == ("z" as char)
  assert c.getClass() == String
  assert c in String

Are you saying you don't want the 2nd assert to work any longer, so that...

  assert c != ("z" as char)

works in Groovy3 ?

Cheers,
Gavin Grover
blog: http://groovy.codeplex.com/wikipage?title=Blog02
email: gvgrover@...

(Continue reading)

Wujek Srujek | 1 Jul 2012 13:36
Picon

[groovy-user] compiling in groovy without all jars in classpath

Hi. I have the following case: WebApplication is a class in ApacheWicket, and it has a field of type javax.servlet.ServletContext. When I compile a class that extends WebApplication in Java, it compiles fine - I don't need the servlet classes in the classpath. However, the same can't be said about Groovy compilation - I get some exception in some transformation, whose root cause is a NoCassDefFoundError: javax.servlet.ServletContext (I hope this is enough info for you, if not, I can whip up some example to get the stacktrace).

Why does Groovy require me to have all the classes in the classpath? I originally asked the question on the Gradle forum, as I am using it to build my project, and Peter Niederweiser mentioned that you are doing a lot of reflection and stuff. Could you please say something more about the nature of the issue? He mentioned you want to fix it in 2.x / 3.x - is that the case?

wujek
Evgeny Goldin | 1 Jul 2012 21:10
Picon
Gravatar

[groovy-user] Re: Groovy-Eclipse compiler plugin for Maven replacing gmaven

Hi,

Is there any information available regarding GMaven release supporting
Groovy 2.0? Tried using version 1.4 but it failed to work with
groovy-all:2.0.0 :(

Thanks!

-----
Best regards,

Evgeny

evgeny-goldin.com 

--
View this message in context: http://groovy.329449.n5.nabble.com/Groovy-Eclipse-compiler-plugin-for-Maven-replacing-gmaven-tp5709858p5710467.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Guillaume Laforge | 1 Jul 2012 21:53
Gravatar

Re: [groovy-user] Re: Groovy-Eclipse compiler plugin for Maven replacing gmaven

Hi Evgeny,


I think I had tried with one of the RCs (or was it a beta?) and it worked, when GMaven is configured properly.
It's supposed to work when using the right provider, when putting the groovy dependency twice, in your project and in the plugin configuration.
What does your pom look like?

Guillaume

On Sun, Jul 1, 2012 at 9:10 PM, Evgeny Goldin <evgenyg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
Hi,

Is there any information available regarding GMaven release supporting
Groovy 2.0? Tried using version 1.4 but it failed to work with
groovy-all:2.0.0 :(

Thanks!

-----
Best regards,

Evgeny

evgeny-goldin.com

--
View this message in context: http://groovy.329449.n5.nabble.com/Groovy-Eclipse-compiler-plugin-for-Maven-replacing-gmaven-tp5709858p5710467.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
Jochen Theodorou | 1 Jul 2012 23:53
Picon
Gravatar

Re: [groovy-user] Groovy 3 and the equality of char and a String of length 1

Am 01.07.2012 11:15, schrieb Gavin Grover:
> ----- Original Message -----
[...]
> All of the following work in Groovy 2.0.
>
>    def c="z"
>    assert c == "z"
>    assert c == ("z" as char)
>    assert c.getClass() == String
>    assert c in String
>
> Are you saying you don't want the 2nd assert to work any longer, so that...

def c="z" makes c a String. I don't to change that at all. Therefore the 
second assert is not influenced too.

actually I found out we have conversion rules for Strings of length 1, 
but we don't apply them. I thought

def foo(char c){1}
assert foo("z")==1

works, but it does not!

The situation I wanted to reach is already the case it seems.

bye blackdrag

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Jochen Theodorou | 2 Jul 2012 00:00
Picon
Gravatar

Re: [groovy-user] compiling in groovy without all jars in classpath

Am 01.07.2012 13:36, schrieb Wujek Srujek:
> Hi. I have the following case: WebApplication is a class in
> ApacheWicket, and it has a field of type javax.servlet.ServletContext.
> When I compile a class that extends WebApplication in Java, it compiles
> fine - I don't need the servlet classes in the classpath. However, the
> same can't be said about Groovy compilation - I get some exception in
> some transformation, whose root cause is a NoCassDefFoundError:
> javax.servlet.ServletContext (I hope this is enough info for you, if
> not, I can whip up some example to get the stacktrace).
> Why does Groovy require me to have all the classes in the classpath? I
> originally asked the question on the Gradle forum, as I am using it to
> build my project, and Peter Niederweiser mentioned that you are doing a
> lot of reflection and stuff. Could you please say something more about
> the nature of the issue? He mentioned you want to fix it in 2.x / 3.x -
> is that the case?

The compiler works entirely using reflection, when it comes to use other 
classes. That for example means if your class references another class 
in a private field (as type), our classloader does have to load it, 
since that is how class loading works. If you parse the .class file, you 
can skip such entries and thus save on classes you have to load, not to 
mention that you don't involve the classloader at all. As a result you 
can compile something in Java that does not compile in Groovy, since the 
Groovy compiler requests additional classes.

And yes, we intend to change that finally - as long as the compilation 
is done from the command line. I don't remember the exact target, but it 
wil go into 2.x unless the change is too big, then it will be Groovy3. 
Bte, there has already been a request like that in the past, but back 
then I closed it as "won't fix". Back then it was not clear to me what 
it means for some people, that for example use that stupid stripped down 
J2EE libs, that are incomplete classes and thus will not pass the 
verifier if loaded as a class. And that is the case if we compile in 
Groovy. It may also improve the speed of the compiler a bit to do that 
change, but that we will have to see after it is implemented.

bye blackdrag

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Evgeny Goldin | 2 Jul 2012 00:10
Picon
Gravatar

[groovy-user] Re: Groovy-Eclipse compiler plugin for Maven replacing gmaven

Right now GMaven 1.4 declares its dependency on "2.0.0-beta-2". Here's 
https://github.com/evgeny-goldin/maven-plugins/blob/44c4867ea6b6acf13a24d84266b9d1ca1aca4bbd/pom.xml#L182
my POM  and when run it throws the following NPE (
http://groovy.329449.n5.nabble.com/file/n5710471/log.txt log.txt ):

-----
Best regards,

Evgeny

evgeny-goldin.com 

--
View this message in context: http://groovy.329449.n5.nabble.com/Groovy-Eclipse-compiler-plugin-for-Maven-replacing-gmaven-tp5709858p5710471.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email

Bob Brown | 2 Jul 2012 07:29
Picon
Favicon

[groovy-user] Another Groovy-3 WIBNI

WIBNI = Wouldn't It Be Nice If

In part due to advancing years (and the resulting mental inflexibility) and in part due to micro-benchmark (micro-benchmark madness, some might say: 
http://wordpress.transentia.com.au/wordpress/2009/06/07/trivial-groovy-micro-benchmark/) I tend to prefer the groovy 'for' loop to do simple iteration over a collection.

ie: 

for (c in myCollection) { doSomethingNeat(c) }

Rather than:

myCollection.each { c -> doSomethngNeat(c) } 

This is all fine, until I have the need to access the index. I am then forced into either maintaining a counter manually alongside the for loop, as in:

def index = 0
for (c in myCollection) {  doSomethingNeater(c, index); index ++}

Or to use eachWithIndex:

myCollection.eachWithIndex { c, index -> doSomethingNeater(c, index) } 

Neither of these "float my boat."

(Judging by history) I am sure that no-one will like this idea, but what about:

for (c, index in myCollection) { doSomethingNeater(c, index) }

OK…not very 'groovy'/functional/whatever. But I am SURE that we can all find LOTS of use cases.

I was prompted to emit this email after reading (I THINK in stack overflow) a comment along the lines of "if you find your self declaring a variable before using each{} specially for use in the each closure, you are probably using the wrong feature". The commenter then pointed out collect, inject, etc. as better ways to do things. This got me thinking about the for loop and lack of better/alternatives…and led to this thing you are reading.

Cheers,

BOB
Guillaume Laforge | 2 Jul 2012 10:01
Gravatar

Re: [groovy-user] Re: Groovy-Eclipse compiler plugin for Maven replacing gmaven

When I tried, I got it working by excluding the 2.0.0-beta-2 version from my dependencies, as far as I recall.

Could you try that?

On Mon, Jul 2, 2012 at 12:10 AM, Evgeny Goldin <evgenyg <at> gmail.com> wrote:
Right now GMaven 1.4 declares its dependency on "2.0.0-beta-2". Here's
https://github.com/evgeny-goldin/maven-plugins/blob/44c4867ea6b6acf13a24d84266b9d1ca1aca4bbd/pom.xml#L182
my POM  and when run it throws the following NPE (
http://groovy.329449.n5.nabble.com/file/n5710471/log.txt log.txt ):



-----
Best regards,

Evgeny

evgeny-goldin.com

--
View this message in context: http://groovy.329449.n5.nabble.com/Groovy-Eclipse-compiler-plugin-for-Maven-replacing-gmaven-tp5709858p5710471.html
Sent from the groovy - user mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email





--
Guillaume Laforge
Groovy Project Manager
Head of Groovy Development at SpringSource
http://www.springsource.com/g2one
Ronny Løvtangen | 2 Jul 2012 10:51

[groovy-user] TimeCategory not working for a limited period

For some reason, I suddenly got a few errors of type:

"groovy.lang.MissingPropertyException: No such property: minutes for class: java.lang.Integer"

on the line "threshold = 3.minutes.ago" in the following block:

	Date threshold
	use(TimeCategory) {
		threshold = 3.minutes.ago
	}

(TimeCategory is groovy.time.TimeCategory)

I have no clue how this could suddenly happen. I got a few of these errors in my log file, but now it seems to work
fine again.
Any ideas?

I'm using Groovy 1.8.6 (in a Grails 2.0.3 application)

Ronny
---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Gmane