groovy-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pa...@apache.org
Subject [groovy] branch GROOVY_2_5_X updated: GROOVY-7856: Adding CompileStatic via compiler config script to class with eachWithIndex results in exception in instruction selection phase
Date Sat, 16 Mar 2019 10:40:17 GMT
This is an automated email from the ASF dual-hosted git repository.

paulk pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
     new fc30fc4  GROOVY-7856: Adding CompileStatic via compiler config script to class with
eachWithIndex results in exception in instruction selection phase
fc30fc4 is described below

commit fc30fc486a33f002844983f47dd17674bf0c98e1
Author: Eric Milles <eric.milles@thomsonreuters.com>
AuthorDate: Sat Mar 16 20:39:46 2019 +1000

    GROOVY-7856: Adding CompileStatic via compiler config script to class with eachWithIndex
results in exception in instruction selection phase
    
    (pass through compilationUnit when needed)
---
 .../groovy/control/customizers/DelegatingCustomizer.java      | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/control/customizers/DelegatingCustomizer.java
b/src/main/java/org/codehaus/groovy/control/customizers/DelegatingCustomizer.java
index 68e394a..d3d51e5 100644
--- a/src/main/java/org/codehaus/groovy/control/customizers/DelegatingCustomizer.java
+++ b/src/main/java/org/codehaus/groovy/control/customizers/DelegatingCustomizer.java
@@ -18,9 +18,11 @@
  */
 package org.codehaus.groovy.control.customizers;
 
+import groovy.transform.CompilationUnitAware;
 import org.codehaus.groovy.ast.ClassNode;
 import org.codehaus.groovy.classgen.GeneratorContext;
 import org.codehaus.groovy.control.CompilationFailedException;
+import org.codehaus.groovy.control.CompilationUnit;
 import org.codehaus.groovy.control.SourceUnit;
 
 /**
@@ -29,7 +31,7 @@ import org.codehaus.groovy.control.SourceUnit;
  *
  * @since 2.1.0
  */
-public abstract class DelegatingCustomizer extends CompilationCustomizer {
+public abstract class DelegatingCustomizer extends CompilationCustomizer implements CompilationUnitAware
{
     protected final CompilationCustomizer delegate;
 
     public DelegatingCustomizer(CompilationCustomizer delegate) {
@@ -38,6 +40,13 @@ public abstract class DelegatingCustomizer extends CompilationCustomizer
{
     }
 
     @Override
+    public void setCompilationUnit(final CompilationUnit compilationUnit) {
+        if (delegate instanceof CompilationUnitAware) {
+            ((CompilationUnitAware) delegate).setCompilationUnit(compilationUnit);
+        }
+    }
+
+    @Override
     public void call(final SourceUnit source, final GeneratorContext context, final ClassNode
classNode) throws CompilationFailedException {
         delegate.call(source, context, classNode);
     }


Mime
View raw message