Aristedes Maniatis | 30 May 13:27 2016
Picon
Gravatar

JVM crash after groovy 2.4.6 upgrade

This is a little stab in the dark, but we are seeing JVM crashes (at least 10 so far, so it isn't a fluke) after a
recent groovy 2.4.5 -> 2.4.6 upgrade.

The crash happens here [libzip.so+0x517a] ZIP_GetEntry+0x11a which appears to be triggered by groovy
invoking the class loader to compile something.

Full details here:
    https://gist.github.com/ari/fc827478f7d48a0e5282c83a7b4ad3a4

The closest openJDK bug reports I could find are caused by something trying to change the contents of a zip
while it is open. Because I haven't yet figured how to make the JVM crash on demand, I haven't been able to
pinpoint this. And as you can see, my code involves JasperReports invoking Groovy and there is quite a lot
going on.

But I thought I'd give it a shot: has anyone seen something similar? Is this likely to be related to the
upgrade of groovy?

Cheers
Ari

--

-- 
-------------------------->
Aristedes Maniatis
CEO, ish
https://www.ish.com.au
GPG fingerprint CBFB 84B4 738D 4E87 5E5C  5EFA EF6A 7D2E 3E49 102A

Schalk Cronjé | 29 May 23:47 2016
Picon

<at> CompileStatic & interfaces

Simple question: Does it actually make any difference to have interfaces annotated with <at> CompileStatic?


-- Schalk W. Cronjé Twitter / Ello / Toeter : <at> ysb33r
David Eisner | 27 May 15:39 2016
Picon
Gravatar

groovysh classpath switch not working under Windows

I'm trying to set the classpath for a groovysh session with the classpath switch (e.g. "-cp" or "-classpath"). On Linux (and under Cygwin with an sdkman-installed Groovy), it works fine.

But under Windows (both Windows 7 64-bit and Windows 10 64-bit, installed using the Windows installer) I get this error:

PS C:\> groovysh -cp .
Unrecognized option: -cp
error: jvm creation failed with code -1: unknown error
PS C:\> groovysh -classpath .
Unrecognized option: -classpath
error: jvm creation failed with code -1: unknown error

I'm using the current directory as an example argument, but I get the same error no matter what I try.

In all cases (Linux, Cygwin w/ sdkman, Windows 7 and 10) this is Groovy 2.4.6 with JVM 1.8.0_91). One other thing: the problem occurs whether I'm using PowerShell or cmd.exe.

I don't see any bugs filed against this in JIRA. I'm new to groovy, so perhaps I'm missing something. Any ideas?

Thanks.

-David
Paolo Di Tommaso | 26 May 20:06 2016
Picon
Gravatar

List and GString

Dear all, 

I have a use case in which I need to override the `toString` method of a custom List class and use it when interpolating that list object in a GString. 

It turns out the Groovy uses its own formatting methods for List and other structures, so the my custom `toString` is simply ignored. 

To explain it better take in consideration this example: 

class MyList extends ArrayList {

  String toString() {
    this.join('-')
  }

}


def x = new MyList()
x << 1 << 2 << 3 

assert x.toString() == '1-2-3'
assert "$x" == '1-2-3'

Assertion failed: 
assert "$x" == '1-2-3'
         |  |
         |  false
         [1, 2, 3]

The second assertion fails for the reason said above. Now I'm wondering it there's any way to override somehow the GString default rendering mechanism in such a way I can inject my own formatting rule for my custom class. 

Any suggestion is appreciated. 



Cheers,
Paolo



Benjamin Gudehus | 23 May 17:09 2016
Picon
Gravatar

[OT] Old Mailing-list on Nabble

Hey,

for (nearly) every message to the Apache Groovy Mailing-lists I receive two mails (one from groovy.apache.org and one from n5.nabble.com).

Unfortunately the URL to the Nabble forum on [1] redirects to [1] itself. Which means I can't use the Nabble user interface to unsubscribe (if there was any).
Clicking on the unsubscribe link in the footer of the mails does the same.

I wonder if there's a way to unsubscribe. If not, as a work-around, I'll filter all mails from n5.nabble.com that contain the text "groovy.329449.n5.nabble.com".


Regards,
Benjamin

Rahul Somasunderam | 22 May 20:52 2016
Gravatar

GroovyLexer and newlines in comments

Hi!

I've got this code 

```
 <at> Grab('org.fusesource.jansi:jansi:1.12')

import static org.fusesource.jansi.Ansi.Color.RED
import static org.fusesource.jansi.Ansi.ansi

import groovyjarjarantlr.Token
import org.codehaus.groovy.antlr.parser.GroovyLexer
import org.fusesource.jansi.AnsiConsole

AnsiConsole.systemInstall()

/**
 * Some class
 */
class Foo {
    /**
     *
     *  <at> param a
     *  <at> param b
     *  <at> param c
     *  <at> return
     */
    String doSomething(String a, int b, double c) {
        ''
    }
}
def lexer = new GroovyLexer(new File('gpa.groovy').newInputStream())
lexer.setWhitespaceIncluded(true)
def lastLine = 0

while (true) {
    def t = lexer.nextToken()
    if (!t || t.type == Token.EOF_TYPE) {
        break
    }
    if (lastLine != t.line) {
        println ''
        def lineNum = t.line.toString().padLeft(4)
        print ansi().fg(RED).a(lineNum).a('| ').reset()
        lastLine = t.line
    }
    print t.text
}
println ''```

When I run it, it parses itself, and prints itself out with line numbers.
There are 2 weird things I see.

1. The comments and javadoc get squished into one line. Is there a way to
get them unmodified?
2. The last statement doesn't retain the last token which is a constant of
an empty string when the file ends on the same line. This problem goes away
if i add a newline at the end of the file. Is there some way to convince the
lexer to not do that?

Thanks!

R,
rahul

--
View this message in context: http://groovy.329449.n5.nabble.com/GroovyLexer-and-newlines-in-comments-tp5732960.html
Sent from the Groovy Users mailing list archive at Nabble.com.

Schalk Cronjé | 22 May 18:58 2016
Picon

About Gradle, Kotlin and Inner Fear

As a follow-up to Dan Woods post regarding reactions of the ApacheGroovy community to the recent announcement of Kotlin support in Gradle, I had posted the following

  http://delivervalue.blogspot.co.uk/2016/05/about-gradle-kotlin-and-inner-fear.html

in the hope that it will elicit more conversation regarding the state of the Groovy nation.


-- Schalk W. Cronjé Twitter / Ello / Toeter : <at> ysb33r
Guillaume Laforge | 20 May 22:21 2016
Picon
Gravatar

groovy-lang.org down for now

Hi all,

FYI, the Groovy website is currently down.

We're migrating the domain-name to the Apache foundation, but it looks like there are some issues with the transfer. 
The Apache infrastructure team is investigating this, and hopefully it'll be back soon.
But till the DNS changes propagate and so on, it might take a little while till it's back.
Fingers crossed.

In the meantime, sorry for the inconvenience :-(
Thanks for your understanding.

Guillaume

--
Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Product Ninja & Advocate at Restlet

Schalk Cronjé | 19 May 13:59 2016
Picon

NIO2 FIleContentType Provider in Java, Groovy & Kotlin

As I like to say, java.nio.file is like a big wooden crate with some diagrams, but it does not actually contain any useful content.

I had to solve a problem yesterday and wrote this https://github.com/ysb33r/nio2-filedetector-tika. It will detect the content type of a file, bu actually inspecting the first couple of bytes of a file rather than guessing it from the file extension. It uses Apache Tika underneath to do the real work. This allows the java.nio.file.FIles.probeFIieContent(Path) method to actually do something useful and not just return null. \o/

I am posting this here as the repo contains three functionally equivalant implementations - Java, Groovy & Kotlin. (The published artifact on BIntray is the Java one, simply because I did not want to add an additional dependency for such a small implementation). At some stage I'll get around to comparing the performance of the three implementations

This will form part of something else I want to do is showing how to write NIO2 providers in alternative JVM languages.

In the mean-time this might be of interest to those who would like to compare implementations.

-- Schalk W. Cronjé Twitter / Ello / Toeter : <at> ysb33r

GR8Conf EU Registration ends soon!

/*<![CDATA[*/ body{font-family:Helvetica,Arial;font-size:13px} /*]]>*/
Hi,

Registrations for GR8Conf EU ends one week from now, Monday May 23rd. 

You do not want to miss this year's event! Here you can learn all about Groovy, Grails and Gradle from the project founders and core developers!  

From the Groovy core team you can meet: Guillaume Laforge, Cedric Champeau and Jochen Theodorou. From the Grails core team you can meet: Jeff Brown and Graeme Rocher. Cedric also represents Gradle. 

The opening keynote is delivered by Ken Kousen.  

One University day with workshops, Two conference days, Three conference tracks, 24 speakers from all over the world. Not to mention our home brewed beer for Meet & Greet.

For more information, please visit gr8conf.eu now!
 

Best regards,
Søren Berg Glasius
GR8Conf Europe organizing team

GR8Conf ApS
Mobile: +45 40 44 91 88, Web: www.gr8conf.eu, Skype: sbglasius 
Company Address: Buchwaldsgade 50, 5000 Odense C, Denmark
Personal Address: Hedevej 1, Gl. Rye, 8680 Ry, Denmark
--- GR8Conf - Dedicated to the Groovy Ecosystem
Guy Matz | 16 May 17:28 2016
Picon

re-using a comparison closure

Hi!
I have to sort a list of strings based on a number within the string . . .  I am able to sort using something like:
list.sort( { a,b -> getVersion(a) <=> getVersion(b)})

I need to use this in a bunch of places in my code and was hoping to replace it with a method, like:
list.sort( compareVersions)

with compareVersions:
def compareVersions(a, b) {
  return getVersion(a).toInteger() <=> getVersion(b).toInteger()
}

putting the method (compoareVersions) into the sort as a param doesn't work.  Anyone know what I'm missing?

Thanks!!
Guy

Gmane