GROOVY-7905: ListWithDefault DGM methods aren't type inference friendly (add 
bridge methods)


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

Branch: refs/heads/master
Commit: e56a130563ee2695db310f88774ca2f652aee7f0
Parents: dc2f94a
Author: paulk <pa...@asert.com.au>
Authored: Mon Aug 15 17:32:27 2016 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Sun Sep 18 20:14:35 2016 +1000

----------------------------------------------------------------------
 build.gradle                                         | 11 +++++++++++
 .../groovy/runtime/DefaultGroovyMethods.java         | 15 +++++++++++++++
 2 files changed, 26 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/e56a1305/build.gradle
----------------------------------------------------------------------
diff --git a/build.gradle b/build.gradle
index 443f8ea..7f3f007 100644
--- a/build.gradle
+++ b/build.gradle
@@ -141,6 +141,7 @@ ext {
     antVersion = '1.9.7'
     asmVersion = '6.0_ALPHA'
     antlrVersion = '2.7.7'
+    bridgerVersion = '1.1.Final'
     coberturaVersion = '1.9.4.1'
     commonsCliVersion = '1.3.1'
     commonsHttpClientVersion = '3.1'
@@ -201,6 +202,7 @@ dependencies {
     testCompile "com.thoughtworks.qdox:qdox:$qdoxVersion"
 
     tools "com.googlecode.jarjar:jarjar:$jarjarVersion"
+    tools "org.jboss.bridger:bridger:$bridgerVersion"
 
     tools("net.sourceforge.cobertura:cobertura:$coberturaVersion") {
         exclude(module: 'asm')
@@ -313,6 +315,15 @@ processResources.doLast {
     }
 }
 
+tasks.withType(Jar) {
+    doFirst {
+        ant.java(classname:'org.jboss.bridger.Bridger', classpath: 
rootProject.configurations.tools.asPath, outputproperty: 'stdout') {
+            arg(value: 
"${sourceSets.main.output.classesDir.canonicalPath}/org/codehaus/groovy/runtime/DefaultGroovyMethods.class")
+        }
+        ant.echo('Bridger: ' + ant.properties.stdout)
+    }
+}
+
 task ensureGrammars {
     description = 'Ensure all the Antlr generated files are up to date.'
     ext.antlrDirectory = "$projectDir/src/main/org/codehaus/groovy/antlr"

http://git-wip-us.apache.org/repos/asf/groovy/blob/e56a1305/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java 
b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index 18a715e..4cc5e9b 100644
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@ -7903,6 +7903,11 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
         return withLazyDefault(self, init);
     }
 
+    @Deprecated
+    public static <T> List<T> withDefault$$bridge(List<T> self, 
@ClosureParams(value=SimpleType.class, options = "int") Closure<T> init) {
+        return withDefault(self, init);
+    }
+
     /**
      * Decorates a list allowing it to grow when called with a non-existent 
index value.
      * When called with such values, the list is grown in size and a default 
value
@@ -7949,6 +7954,11 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
         return ListWithDefault.newInstance(self, true, init);
     }
 
+    @Deprecated
+    public static <T> List<T> withLazyDefault$$bridge(List<T> self, 
@ClosureParams(value=SimpleType.class, options = "int") Closure<T> init) {
+        return ListWithDefault.newInstance(self, true, init);
+    }
+
     /**
      * Decorates a list allowing it to grow when called with a non-existent 
index value.
      * When called with such values, the list is grown in size and a default 
value
@@ -7989,6 +7999,11 @@ public class DefaultGroovyMethods extends 
DefaultGroovyMethodsSupport {
         return ListWithDefault.newInstance(self, false, init);
     }
 
+    @Deprecated
+    public static <T> List<T> withEagerDefault$$bridge(List<T> self, 
@ClosureParams(value=SimpleType.class, options = "int") Closure<T> init) {
+        return ListWithDefault.newInstance(self, false, init);
+    }
+
     /**
      * Zips an Iterable with indices in (value, index) order.
      * <p/>

Reply via email to