Martin Gropp | 2 Mar 18:48 2015
Picon

[groovy-user] <at> Field and closures: strange behavior

Hi everyone!

I have run into a little problem with  <at> Field-annotated variables in a
Groovy script and writing to them from inside a closure.

Being rather new to Groovy I'm not sure if this is a bug, but at least
it's really confusing and I'm stuck… :/

Here is an example:

>  <at> groovy.transform.Field
> def x = 1;
> 
> // This works:
> // x = 2;
> // { -> this. <at> x = 2; }();
> 
> // This doesn't:
> { -> x = 2; }();
> 
> 
> { -> println x }();        // prints 2
> { -> println this.x }();   // prints 2
> { -> println this. <at> x }();  // prints 1
> println x;                 // prints 1
> println this.x;            // prints 1
> println this. <at> x;           // prints 1
> 
> def script = this;
> {
(Continue reading)

antoaravinth | 2 Mar 15:32 2015
Picon

[groovy-user] Gradle Issue when building Groovy from source.

I'm trying to build groovy from source, using:

gradle --stacktrace clean dist

and its giving me:

java.lang.ClassCastException:
org.gradle.api.internal.changedetection.state.DefaultFileCollectionSnapshotter$FileCollectionSnapshotImpl
cannot be cast to
org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot
	at
org.gradle.api.internal.changedetection.state.OutputFilesCollectionSnapshotter$OutputFilesSnapshot.iterateChangesSince(OutputFilesCollectionSnapshotter.java:115)
	at
org.gradle.api.internal.changedetection.rules.OutputFilesStateChangeRule$1$1.<init>(OutputFilesStateChangeRule.java:44)
	at
org.gradle.api.internal.changedetection.rules.OutputFilesStateChangeRule$1.iterator(OutputFilesStateChangeRule.java:43)
	at
org.gradle.api.internal.changedetection.rules.CachingTaskStateChanges.reset(CachingTaskStateChanges.java:79)
	at
org.gradle.api.internal.changedetection.rules.CachingTaskStateChanges.iterator(CachingTaskStateChanges.java:44)
	at
org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges.firstDirtyIterator(SummaryTaskStateChanges.java:63)
	at
org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges.access$000(SummaryTaskStateChanges.java:25)
	at
org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges$1.computeNext(SummaryTaskStateChanges.java:49)
	at
org.gradle.api.internal.changedetection.rules.SummaryTaskStateChanges$1.computeNext(SummaryTaskStateChanges.java:42)
	at
com.google.common.collect.AbstractIterator.tryToComputeNext(AbstractIterator.java:143)
(Continue reading)

Peter Niederwieser | 2 Mar 15:04 2015
Picon

[groovy-user] [Ann] Spock 1.0 has been released

Dear Groovy Community,

I'm happy to announce that Spock 1.0 has been released. Read all about it here: http://docs.spockframework.org/1.0/release_notes.html

Cheers,
Peter

PS: Make sure to follow our new Twitter Account! https://twitter.com/spockframework
Picon

[groovy-user] How does groovy detect a line break

Hi,
     How does groovy detect a line break even without keeping a
semicolon--";".

Regards,
Jitendra Singh

--
View this message in context: http://groovy.329449.n5.nabble.com/How-does-groovy-detect-a-line-break-tp5722913.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

Maciej Górski | 1 Mar 20:57 2015
Picon

[groovy-user] [Android] Crash when assigning to "result" variable in a class extending Activity

Hello,

I have a weird issue, when assigning to a variable called result, the app crashes with:

Caused by: org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'boom!' with class 'java.lang.String' to class 'int'

Relevant code:

<at> CompileStatic
public final class HomeActivity extends ActionBarActivity {

    private String result

    <at> Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState)
        this.result = "boom!"
    }
}

The crash does not happen when I omit "this." before result.

I looked through the code of base class, base class of base class, base class of base class of base class and base class of base class of base class of base class (yeah, Android) and the only code there that could be causing this is RESULT_OK / RESULT_CANCELLED of type int. Documentation here: http://developer.android.com/reference/android/app/Activity.html#RESULT_CANCELED

Any ideas why this happens?

Cheers,
Maciej Górski

Andres Almiray | 1 Mar 12:35 2015
Picon

[groovy-user] [ANN] Griffon 2.2.0 released!

The Griffon team is happy to announce the release of Griffon 2.2.0!


The following list summarizes the changes brought by this release:

 * An application wide Context that can be used t store key/value pairs.
 * MVCGroups can have their own contexts too.
 * MVCGroups now expose their parent group (if not null).
 * `Configuration` instances can be made writable by wrapping them with `MutableConfiguration`.
 * *breaking change!* Metadata, Environment and RunMode are no longer magic singletons.
   Instances of these classes can now be injected using `javax.inject.Inject`.
 * Updates to JavaFXUtils.

A more detailed description of the changes and compatibility issues can be found at the release notes.

We look forward to your feedback. Please report any problems you find to the Griffon User list, or better yet, file a bug at http://github.com/griffon/griffon/issues

Remember you can also contact the team on Twitter: <at> theaviary.

Many thanks to all who contributed to this release!

The Griffon Team

OC | 28 Feb 09:57 2015
Picon

[groovy-user] Closures and it

Hello there,

the documentation says

===
this code:

def greeting = { "Hello, $it!" }
...
is stricly equivalent to this one:

def greeting = { it -> "Hello, $it!" }
===

First, presumably there's a typo, and it should be “strictly”. What's much more important, my
dictionary says “strictly” should mean in this context “with no exceptions; completely or
absolutely” -- and that is simply not true:

===
4 /tmp> <q.groovy 
2.times {
  it.times {
    println it
  }
}
5 /tmp> groovy q 
0
6 /tmp> <q.groovy
2.times { it ->
  it.times { it ->
    println it
  }
}
7 /tmp> groovy q 
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
/private/tmp/q.groovy: 2: The current scope already contains a variable of the name it
  <at>  line 2, column 12.
     it.times { it ->
              ^

1 error

8 /tmp> 
===

As a side-note, let me please again point out that in my opinion, this should be fixed, and Groovy should
allow the latter variant like C-based languages do (not just with “it”, but with any variable; not
just with a closure, but with all kinds of scoped blocks); the Java approach which prevents obscuring a
variable in a nested scope is, in my personal opinion, simply wrong -- one of so many attempts to make the
language “safer” which, in fact, makes it only inconvenient and in practice unsafe (since e.g., when
copy/pasting code, one has to rename variables).

All the best,
OC

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

    http://xircles.codehaus.org/manage_email

antoaravinth | 27 Feb 14:02 2015
Picon

[groovy-user] Help In Solving The bug GROOVY-7257

I’m trying to solve the bug that is mentioned over here:

https://jira.codehaus.org/browse/GROOVY-7257?jql=project%20%3D%20GROOVY%20AND%20resolution%20%3D%20Unresolved%20AND%20priority%20%3D%20Trivial%20ORDER%20BY%20key%20DESC

Looks like if he runs the groovy doc tool with public argument and he
 <at> PackageScope in a variable/method, it also comes in the documentation.
Something like this:

groovydoc -public -d ./doc/ GROOVY-7257.groovy

generates documentation for all the fields, regardless of  <at> PackageScope
definition. 

I tried to walkthrough the code base and found the issue is the code-base
isn’t checking the arguments at all (or I might be wrong here). The class
SimpleGroovyClassDocAssembler does the job of visiting and setting the
properties of the source file passed. In the methods like visitVariableDef,
visitMethodCall it doesn’t check the properties (instance variable which has
the arguments passed while groovydoc command is called , passed down from
org.codehays.groovy.tools.groovydoc.Main class). 

Looks like we need to add checks over there in the methods, according to the
groovydoc specification. 

Can I write them and give a PR. Or I’m missing some information here :)

--
View this message in context: http://groovy.329449.n5.nabble.com/Help-In-Solving-The-bug-GROOVY-7257-tp5722871.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

Batman | 27 Feb 09:11 2015
Picon

[groovy-user] Couldnt able to compile groovy from local source.

Hi I have checked out the Groovy project from github. 

And my git log gives me the last commit as: 

git log -n 1 
commit 80e01f03399908f52e892356564c67073de3ab2a 
Author: Cedric Champeau <cedric.champeau@...>
Date:   Thu Feb 26 17:32:00 2015 +0100 

    Documentation for object graph builder 

But when I try to compile and build the dist: 

gradle clean dist 

I get the error: 

To honour the JVM settings for this build a new JVM will be forked. Please
consider using the daemon:
http://gradle.org/docs/1.12/userguide/gradle_daemon.html. 
:buildSrc:compileJava UP-TO-DATE 
:buildSrc:compileGroovy UP-TO-DATE 
:buildSrc:processResources UP-TO-DATE 
:buildSrc:classes UP-TO-DATE 
:buildSrc:jar UP-TO-DATE 
:buildSrc:assemble UP-TO-DATE 
:buildSrc:compileTestJava UP-TO-DATE 
:buildSrc:compileTestGroovy UP-TO-DATE 
:buildSrc:processTestResources UP-TO-DATE 
:buildSrc:testClasses UP-TO-DATE 
:buildSrc:test UP-TO-DATE 
:buildSrc:check UP-TO-DATE 
:buildSrc:build UP-TO-DATE 
Using Java from
/Library/Java/JavaVirtualMachines/jdk1.7.0_25.jdk/Contents/Home/jre (version
1.7.0_25) 
Detected development environment 

FAILURE: Build failed with an exception. 

* Where: 
Script
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle' line:
2 

* What went wrong: 
Could not compile script
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle'. 
> startup failed: 
  script
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle': 2:
unable to resolve class groovy.text.markup.TemplateConfiguration 
    <at>  line 2, column 1. 
     import groovy.text.markup.TemplateConfiguration 
     ^ 

  script
'/Users/anto_belgin/programs/groovy/groovy-core/gradle/quality.gradle': 1:
unable to resolve class groovy.text.markup.MarkupTemplateEngine 
    <at>  line 1, column 1. 
     import groovy.text.markup.MarkupTemplateEngine 
     ^ 

  2 errors 

* Try: 
Run with --stacktrace option to get the stack trace. Run with --info or
--debug option to get more log output. 

BUILD FAILED 

Total time: 11.37 secs 

The import in the quality.gradle in the path /gradle/quality.gradle is what
causing issue. 

Since I have checkout the project from repo, not sure, why I'm facing this
issue.

--
View this message in context: http://groovy.329449.n5.nabble.com/Couldnt-able-to-compile-groovy-from-local-source-tp5722865.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

Martin d'Anjou | 27 Feb 05:13 2015
Picon

[groovy-user] Unable to resolve enum

Groovy is unable to resolve the inner enum. This is strange because when 
I remove the Lib.Width variable declaration, it works.

UserPlugin.groovy:
import Lib
class UserPlugin {
   public static void main(String[] args) {
     // No issue printing this one if the LibWidth declaration is 
commented out
     println(Lib.Width.ONE)

     // But the following line fails
     Lib.Width w
   }
}

lib/Lib.groovy:
class Lib {
   enum Width { ONE(1), TWO(2) }
}

groovy-2.4.1/bin/groovy -cp lib UserPlugin.groovy

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup 
failed:
/mnt/homes/home/martin/tmp/groovy_dynclass_loading/UserPlugin.groovy: 6: 
unable to resolve class Lib.Width
   <at>  line 6, column 15.
        Lib.Width w

Can this be solved without compiling the code and leaving it all scripted?

Martin

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

    http://xircles.codehaus.org/manage_email

Martin d'Anjou | 27 Feb 03:02 2015
Picon

[groovy-user] How to use import inside a dynamically loaded groovy file

I am stumped, so I posted my question on stackoverflow
http://stackoverflow.com/questions/28756273/how-to-use-import-inside-a-dynamically-loaded-groovy-file

Any help appreciated.

Thanks,
Martin

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

    http://xircles.codehaus.org/manage_email


Gmane