You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2015/12/12 00:30:21 UTC

[6/7] groovy git commit: GROOVY-7708 - StreamingJsonBuilder - improve @CompileStatic support (closes #209)

GROOVY-7708 - StreamingJsonBuilder - improve @CompileStatic support (closes #209)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/ae9a433a
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/ae9a433a
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/ae9a433a

Branch: refs/heads/GROOVY_2_4_X
Commit: ae9a433a17df5e0c1336cb5559edb8da33e8f550
Parents: 7bf4390
Author: graemerocher <gr...@gmail.com>
Authored: Wed Dec 9 14:49:15 2015 +0100
Committer: John Wagenleitner <jw...@apache.org>
Committed: Fri Dec 11 14:41:42 2015 -0800

----------------------------------------------------------------------
 .../main/java/groovy/json/StreamingJsonBuilder.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/ae9a433a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
index 7290d52..0f6d41a 100644
--- a/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
+++ b/subprojects/groovy-json/src/main/java/groovy/json/StreamingJsonBuilder.java
@@ -587,7 +587,7 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
          * @param coll a collection
          * @param c a closure used to convert the objects of coll
          */
-        public void call(String name, Iterable coll, Closure c) throws IOException {
+        public void call(String name, Iterable coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
             writeName(name);
             writeObjects(coll, c);
         }
@@ -595,7 +595,7 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
         /**
          * Delegates to {@link #call(String, Iterable, Closure)}
          */
-        public void call(String name, Collection coll, Closure c) throws IOException {
+        public void call(String name, Collection coll, @DelegatesTo(StreamingJsonDelegate.class) Closure c) throws IOException {
             call(name, (Iterable)coll, c);
         }
 
@@ -696,11 +696,11 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
             return args.length == 2 && args[0] instanceof Iterable && args[1] instanceof Closure;
         }
 
-        public static Object writeCollectionWithClosure(Writer writer, Collection coll, Closure closure) throws IOException {
+        public static Object writeCollectionWithClosure(Writer writer, Collection coll, @DelegatesTo(StreamingJsonDelegate.class) Closure closure) throws IOException {
             return writeCollectionWithClosure(writer, (Iterable)coll, closure);
         }
 
-        public static Object writeCollectionWithClosure(Writer writer, Iterable coll, Closure closure) throws IOException {
+        public static Object writeCollectionWithClosure(Writer writer, Iterable coll, @DelegatesTo(StreamingJsonDelegate.class) Closure closure) throws IOException {
             writer.write(JsonOutput.OPEN_BRACKET);
             boolean first = true;
             for (Object it : coll) {
@@ -723,12 +723,12 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
             writer.write(JsonOutput.CLOSE_BRACE);
         }
 
-        public static void cloneDelegateAndGetContent(Writer w, Closure c)
+        public static void cloneDelegateAndGetContent(Writer w, @DelegatesTo(StreamingJsonDelegate.class) Closure c)
         {
             cloneDelegateAndGetContent(w, c, true);
         }
 
-        public static void cloneDelegateAndGetContent(Writer w, Closure c, boolean first) {
+        public static void cloneDelegateAndGetContent(Writer w, @DelegatesTo(StreamingJsonDelegate.class) Closure c, boolean first) {
             StreamingJsonDelegate delegate = new StreamingJsonDelegate(w, first);
             Closure cloned = (Closure) c.clone();
             cloned.setDelegate(delegate);
@@ -736,11 +736,11 @@ public class StreamingJsonBuilder extends GroovyObjectSupport {
             cloned.call();
         }
 
-        public static void curryDelegateAndGetContent(Writer w, Closure c, Object o) {
+        public static void curryDelegateAndGetContent(Writer w, @DelegatesTo(StreamingJsonDelegate.class) Closure c, Object o) {
             curryDelegateAndGetContent(w, c, o, true);
         }
 
-        public static void curryDelegateAndGetContent(Writer w, Closure c, Object o, boolean first) {
+        public static void curryDelegateAndGetContent(Writer w, @DelegatesTo(StreamingJsonDelegate.class) Closure c, Object o, boolean first) {
             StreamingJsonDelegate delegate = new StreamingJsonDelegate(w, first);
             Closure curried = c.curry(o);
             curried.setDelegate(delegate);