[groovy] branch GROOVY_3_0_X updated (dbe7a69 -> 1adaa63)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[groovy] branch GROOVY_3_0_X updated (dbe7a69 -> 1adaa63)

paulk
This is an automated email from the ASF dual-hosted git repository.

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


    from dbe7a69  GROOVY-9478: Some additional doco links
     new 5730563  remove now redundant JDK version checks
     new 1adaa63  GROOVY-9469: Preserve exception in global AST transformation creation (closes #1193)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 build.gradle                                       | 12 -----------
 gradle/docs.gradle                                 | 10 ++++-----
 gradle/test.gradle                                 |  4 +---
 .../groovy/transform/ASTTransformationVisitor.java |  3 ++-
 .../TransformsAndCustomClassLoadersTest.groovy     | 24 ++++++++++++++++++++++
 5 files changed, 31 insertions(+), 22 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[groovy] 01/02: remove now redundant JDK version checks

paulk
This is an automated email from the ASF dual-hosted git repository.

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

commit 57305638cea3a4e7ca7ab85f826cac57f111acf4
Author: Paul King <[hidden email]>
AuthorDate: Sun Mar 29 19:58:31 2020 +1000

    remove now redundant JDK version checks
---
 build.gradle       | 12 ------------
 gradle/docs.gradle | 10 ++++------
 gradle/test.gradle |  4 +---
 3 files changed, 5 insertions(+), 21 deletions(-)

diff --git a/build.gradle b/build.gradle
index 938051e..03e872e 100644
--- a/build.gradle
+++ b/build.gradle
@@ -219,10 +219,6 @@ sourceSets {
     main {
         java {
             srcDir "$generatedDirectory/antlr2/src/main"
-            if (!JavaVersion.current().isJava8Compatible()) {
-                exclude '**/v8/*'
-                exclude '**/vm8/*'
-            }
             if (!JavaVersion.current().isJava9Compatible()) {
                 exclude '**/v9/*'
                 exclude '**/vm9/*'
@@ -230,10 +226,6 @@ sourceSets {
         }
         groovy {
             srcDir "$generatedDirectory/antlr2/src/main"
-            if (!JavaVersion.current().isJava8Compatible()) {
-                exclude '**/v8/*'
-                exclude '**/vm8/*'
-            }
             if (!JavaVersion.current().isJava9Compatible()) {
                 exclude '**/v9/*'
                 exclude '**/vm9/*'
@@ -251,10 +243,6 @@ sourceSets {
     test {
         groovy {
             srcDirs = ['src/test']
-            if (!JavaVersion.current().isJava8Compatible()) {
-                exclude '**/v8/*'
-                exclude '**/vm8/*'
-            }
             if (!JavaVersion.current().isJava9Compatible()) {
                 exclude '**/v9/*'
                 exclude '**/vm9/*'
diff --git a/gradle/docs.gradle b/gradle/docs.gradle
index e655b96..21973f1 100644
--- a/gradle/docs.gradle
+++ b/gradle/docs.gradle
@@ -193,11 +193,9 @@ task docGDK {
 
 javadocAll.options.source = '1.8'
 
-if (JavaVersion.current().isJava8Compatible()) {
-    allprojects {
-        tasks.withType(Javadoc) {
-            // disable the crazy super-strict doclint tool in Java 8
-            options.addStringOption('Xdoclint:none', '-quiet')
-        }
+allprojects {
+    tasks.withType(Javadoc) {
+        // disable the crazy super-strict doclint tool in Java 8
+        options.addStringOption('Xdoclint:none', '-quiet')
     }
 }
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 4d3d282..a5c4926 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -25,10 +25,8 @@ allprojects {
         if (JavaVersion.current().isJava9Compatible()) {
             jvmArgs (*common, *jdk9)
             systemProperty "groovy.force.illegal.access", findProperty("groovy.force.illegal.access")
-        } else if (JavaVersion.current().isJava8Compatible()) {
-            jvmArgs (*common, *jdk8)
         } else {
-            jvmArgs (*common, "-XX:PermSize=${groovyJUnit_permSize}", "-XX:MaxPermSize=${groovyJUnit_maxPermSize}")
+            jvmArgs (*common, *jdk8)
         }
         def headless = System.properties['java.awt.headless']
         if (headless == 'true') {

Reply | Threaded
Open this post in threaded view
|

[groovy] 02/02: GROOVY-9469: Preserve exception in global AST transformation creation (closes #1193)

paulk
In reply to this post by paulk
This is an automated email from the ASF dual-hosted git repository.

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

commit 1adaa639341cf5624a9135725f7fc544d676ce22
Author: Marcin ZajÄ…czkowski <[hidden email]>
AuthorDate: Sun Mar 15 17:53:33 2020 +0100

    GROOVY-9469: Preserve exception in global AST transformation creation (closes #1193)
   
    InvocationTargetException is not very meaningful. It worked up until Groovy 2.5.7.
---
 .../groovy/transform/ASTTransformationVisitor.java |  3 ++-
 .../TransformsAndCustomClassLoadersTest.groovy     | 24 ++++++++++++++++++++++
 2 files changed, 26 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java b/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
index 016c0fd..ee9bebc 100644
--- a/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
+++ b/src/main/java/org/codehaus/groovy/transform/ASTTransformationVisitor.java
@@ -345,9 +345,10 @@ public final class ASTTransformationVisitor extends ClassCodeVisitorSupport {
                         + entry.getValue().toExternalForm() + " is not an ASTTransformation.", null));
                 }
             } catch (Exception e) {
+                Throwable effectiveException = e instanceof InvocationTargetException ? e.getCause() : e;
                 compilationUnit.getErrorCollector().addError(new SimpleMessage(
                     "Could not instantiate global transform class " + entry.getKey() + " specified at "
-                    + entry.getValue().toExternalForm() + "  because of exception " + e.toString(), null));
+                    + entry.getValue().toExternalForm() + "  because of exception " + effectiveException.toString(), null));
             }
         }
     }
diff --git a/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy b/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy
index 55be8d9..c04c371 100644
--- a/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy
+++ b/src/test/org/codehaus/groovy/transform/classloading/TransformsAndCustomClassLoadersTest.groovy
@@ -24,6 +24,7 @@ import org.codehaus.groovy.ast.ASTNode
 import org.codehaus.groovy.ast.ModuleNode
 import org.codehaus.groovy.ast.ClassNode
 import org.codehaus.groovy.control.CompilationUnit
+import org.codehaus.groovy.control.MultipleCompilationErrorsException
 import org.codehaus.groovy.control.SourceUnit
 import org.codehaus.groovy.control.CompilePhase
 import org.codehaus.groovy.transform.GroovyASTTransformationClass
@@ -37,6 +38,7 @@ import java.lang.annotation.Retention
 import java.lang.annotation.RetentionPolicy
 import java.lang.annotation.Target
 import java.lang.annotation.ElementType
+import java.nio.file.FileSystemNotFoundException
 
 /**
  * Tests whether local and global transforms are successfully detected, loaded,
@@ -90,6 +92,18 @@ class TransformsAndCustomClassLoadersTest extends GroovyTestCase {
         assert clazz.name == "FOO"
     }
 
+    void testShouldKeepOriginalExceptionDuringGlobalTransformApplyingGroovy9469Bug() {
+        try {
+            transformLoader = new GlobalTestTransformClassLoader(transformLoader, FailingWithMeaningfulMessageTransformation)
+            compileAndLoadClass("class Foo {}", dependencyLoader, transformLoader)
+            fail("Excepted MultipleCompilationErrorsException not thrown")
+        } catch(MultipleCompilationErrorsException e) {
+            assert e.message.contains("FailingWithMeaningfulMessageTransformation")
+            assert e.message.contains("FileSystemNotFoundException")
+            assert e.message.contains("meaningful error message")
+        }
+    }
+
     private compileAndLoadClass(String source, GroovyClassLoader dependencyLoader, GroovyClassLoader transformLoader) {
         def unit = new CompilationUnit(null, null, dependencyLoader, transformLoader)
         unit.addSource("Foo.groovy", source)
@@ -161,3 +175,13 @@ class ToUpperCaseGlobalTransform implements ASTTransformation {
         }
     }
 }
+
+@GroovyASTTransformation(phase = CompilePhase.SEMANTIC_ANALYSIS)
+class FailingWithMeaningfulMessageTransformation implements ASTTransformation {
+    FailingWithMeaningfulMessageTransformation() {
+        throw new FileSystemNotFoundException("Custom exception with meaningful error message")
+    }
+    @Override
+    void visit(ASTNode[] nodes, SourceUnit source) {
+    }
+}