You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2022/02/16 12:58:42 UTC

[groovy] branch GROOVY_4_0_X updated (773d525 -> 5785bba)

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

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


    from 773d525  update verification metadata info
     new c70f04e  GROOVY-10290: Dynamic Groovy code in Gradle doesn't compile because of $getLookup() method is not static
     new 606911b  GROOVY-10491: Bump jqwik to 1.6.4 (test dependency)
     new ddb5330  GROOVY-10492: Bump picocli to 4.6.3
     new 505ca51  GROOVY-10493: Bump slf4j to 1.7.36 (test dependency)
     new 5785bba  add extra @PlatformLog doco

The 5 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:
 gradle/verification-metadata.xml                   | 11 +---
 .../groovy/tools/javac/JavaStubGenerator.java      |  2 +-
 src/spec/doc/core-metaprogramming.adoc             | 69 ++++++++++++++++++----
 .../{Groovy6302.groovy => Groovy10290.groovy}      | 29 ++++-----
 subprojects/groovy-test-junit5/build.gradle        |  2 +-
 versions.properties                                |  4 +-
 6 files changed, 76 insertions(+), 41 deletions(-)
 copy src/test/org/codehaus/groovy/tools/stubgenerator/{Groovy6302.groovy => Groovy10290.groovy} (59%)

[groovy] 02/05: GROOVY-10491: Bump jqwik to 1.6.4 (test dependency)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 606911b69284ef66a85b5d67c62562056f7db2dd
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 16 16:44:19 2022 +1000

    GROOVY-10491: Bump jqwik to 1.6.4 (test dependency)
---
 subprojects/groovy-test-junit5/build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/subprojects/groovy-test-junit5/build.gradle b/subprojects/groovy-test-junit5/build.gradle
index 740ea4f..9484d98 100644
--- a/subprojects/groovy-test-junit5/build.gradle
+++ b/subprojects/groovy-test-junit5/build.gradle
@@ -33,7 +33,7 @@ dependencies {
         exclude(group: 'org.apiguardian', module: 'apiguardian-api')
     }
     testImplementation "org.junit.jupiter:junit-jupiter-params:${versions.junit5}"
-    testImplementation 'net.jqwik:jqwik:1.6.3'
+    testImplementation 'net.jqwik:jqwik:1.6.4'
     testRuntimeOnly "org.junit.platform:junit-platform-engine:${versions.junit5Platform}"
     testRuntimeOnly "org.junit.platform:junit-platform-runner:${versions.junit5Platform}"
     testImplementation project(':groovy-test')

[groovy] 04/05: GROOVY-10493: Bump slf4j to 1.7.36 (test dependency)

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 505ca51bdb5e1bd948dbc1044804d295869829ae
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 16 17:02:49 2022 +1000

    GROOVY-10493: Bump slf4j to 1.7.36 (test dependency)
---
 versions.properties | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/versions.properties b/versions.properties
index 283517b..a45c67f 100644
--- a/versions.properties
+++ b/versions.properties
@@ -42,7 +42,7 @@ log4j2=2.17.1
 openbeans=1.0.2
 picocli=4.6.3
 qdox=1.12.1
-slf4j=1.7.33
+slf4j=1.7.36
 xmlunit=1.6
 xstream=1.4.19
 # running with Groovy 4 can be allowed with -Dspock.iKnowWhatImDoing.disableGroovyVersionCheck=true

[groovy] 03/05: GROOVY-10492: Bump picocli to 4.6.3

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ddb533037f910c63e18d365fb8b75136cddced26
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 16 16:55:12 2022 +1000

    GROOVY-10492: Bump picocli to 4.6.3
---
 gradle/verification-metadata.xml | 11 +----------
 versions.properties              |  2 +-
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml
index 95d8524..c3a05a8 100644
--- a/gradle/verification-metadata.xml
+++ b/gradle/verification-metadata.xml
@@ -152,6 +152,7 @@
          <trusted-key id="a5bd02b93e7a40482eb1d66a5f69ad087600b22c" group="org.ow2.asm"/>
          <trusted-key id="a778fde933a96dda827840d8e2b3d84202b812d9" group="org.assertj"/>
          <trusted-key id="a7892505cf1a58076453e52d7999befba1039e8b" group="net.bytebuddy"/>
+         <trusted-key id="aa417737bd805456db3cbdde6601e5c08dccbb96" group="info.picocli" name="picocli"/>
          <trusted-key id="aaaa9d3f580c7223dbd1ff425746ee07d997ddb6" group="net.jqwik"/>
          <trusted-key id="b1fc0e1fa329669191f8306f5bcee695141e6086">
             <trusting group="org.jboss.weld"/>
@@ -518,16 +519,6 @@
             <sha512 value="80be5adf1a1d5f182da3bc718953d0149673c43844690dea30fe00d83ea3886517e88473da48619007932047fd45e461643ec07704b3b7c5b52d798801c6066e" origin="Generated by Gradle because artifact wasn't signed"/>
          </artifact>
       </component>
-      <component group="info.picocli" name="picocli" version="4.6.1">
-         <artifact name="picocli-4.6.1.jar">
-            <pgp value="8756c4f765c9ac3cb6b85d62379ce192d401ab61"/>
-         </artifact>
-      </component>
-      <component group="info.picocli" name="picocli" version="4.6.2">
-         <artifact name="picocli-4.6.2.jar">
-            <pgp value="aa417737bd805456db3cbdde6601e5c08dccbb96"/>
-         </artifact>
-      </component>
       <component group="io.github.x-stream" name="mxparser" version="1.2.1">
          <artifact name="mxparser-1.2.1.jar">
             <pgp value="050a37a2e0577f4baa095b52602ec18d20c4661c"/>
diff --git a/versions.properties b/versions.properties
index eb7edad..283517b 100644
--- a/versions.properties
+++ b/versions.properties
@@ -40,7 +40,7 @@ junit=4.13.2
 log4j=1.2.17
 log4j2=2.17.1
 openbeans=1.0.2
-picocli=4.6.2
+picocli=4.6.3
 qdox=1.12.1
 slf4j=1.7.33
 xmlunit=1.6

[groovy] 05/05: add extra @PlatformLog doco

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 5785bba559214f5a64e63b23e35c80f273935db7
Author: Paul King <pa...@asert.com.au>
AuthorDate: Wed Feb 16 17:58:07 2022 +1000

    add extra @PlatformLog doco
---
 src/spec/doc/core-metaprogramming.adoc | 69 +++++++++++++++++++++++++++++-----
 1 file changed, 59 insertions(+), 10 deletions(-)

diff --git a/src/spec/doc/core-metaprogramming.adoc b/src/spec/doc/core-metaprogramming.adoc
index cb15171..235e7d6 100644
--- a/src/spec/doc/core-metaprogramming.adoc
+++ b/src/spec/doc/core-metaprogramming.adoc
@@ -2116,13 +2116,12 @@ Deprecated. Consider using traits instead.
 
 ==== Logging improvements
 
-Groovy provides AST transformation that helps integrating with the most widely used logging frameworks. It's worth noting
-that annotating a class with one of those annotations doesn't prevent you from adding the appropriate logging framework
-on classpath.
+Groovy provides a family of AST transformations that help with integration of the most widely
+used logging frameworks. There is a transform and associated annotation for each of the common frameworks.
+These transforms provide a streamlined declarative approach to using the logging framework.
+In each case, the transform will:
 
-All transformations work in a similar way:
-
-* add static final `log` field corresponding to the logger
+* add a static final `log` field to the annotated class corresponding to the logger
 * wrap all calls to `log.level()` into the appropriate `log.isLevelEnabled` guard, depending on the underlying framework
 
 Those transformations support two parameters:
@@ -2130,6 +2129,9 @@ Those transformations support two parameters:
 * `value` (default `log`) corresponds to the name of the logger field
 * `category` (defaults to the class name) is the name of the logger category
 
+It's worth noting that annotating a class with one of those annotations doesn't
+prevent you from using the logging framework using the normal long-hand approach.
+
 [[xform-Log]]
 ===== `@groovy.util.logging.Log`
 
@@ -2150,7 +2152,7 @@ include::../test/LogImprovementsASTTransformsTest.groovy[tags=log_equiv,indent=0
 [[xform-Commons]]
 ===== `@groovy.util.logging.Commons`
 
-Groovy supports the http://commons.apache.org/proper/commons-logging/[Apache Commons Logging] framework using to the
+Groovy supports the http://commons.apache.org/proper/commons-logging/[Apache Commons Logging] framework using the
 `@Commons` annotation. Writing:
 
 [source,groovy]
@@ -2165,10 +2167,12 @@ is equivalent to writing:
 include::../test/LogImprovementsASTTransformsTest.groovy[tags=commons_equiv,indent=0]
 ----
 
+You still need to add the appropriate commons-logging jar to your classpath.
+
 [[xform-Log4j]]
 ===== `@groovy.util.logging.Log4j`
 
-Groovy supports the http://logging.apache.org/log4j/1.2/[Apache Log4j 1.x] framework using to the
+Groovy supports the http://logging.apache.org/log4j/1.2/[Apache Log4j 1.x] framework using the
 `@Log4j` annotation. Writing:
 
 [source,groovy]
@@ -2183,10 +2187,14 @@ is equivalent to writing:
 include::../test/LogImprovementsASTTransformsTest.groovy[tags=log4j_equiv,indent=0]
 ----
 
+You still need to add the appropriate log4j jar to your classpath.
+This annotation can also be used with the compatible https://reload4j.qos.ch/[reload4j] log4j
+drop-in replacement, just use the jar from that project instead of a log4j jar.
+
 [[xform-Log4j2]]
 ===== `@groovy.util.logging.Log4j2`
 
-Groovy supports the http://logging.apache.org/log4j/2.x/[Apache Log4j 2.x] framework using to the
+Groovy supports the http://logging.apache.org/log4j/2.x/[Apache Log4j 2.x] framework using the
 `@Log4j2` annotation. Writing:
 
 [source,groovy]
@@ -2201,10 +2209,12 @@ is equivalent to writing:
 include::../test/LogImprovementsASTTransformsTest.groovy[tags=log4j2_equiv,indent=0]
 ----
 
+You still need to add the appropriate log4j2 jar to your classpath.
+
 [[xform-Slf4j]]
 ===== `@groovy.util.logging.Slf4j`
 
-Groovy supports the http://www.slf4j.org/[Simple Logging Facade for Java (SLF4J)] framework using to the
+Groovy supports the http://www.slf4j.org/[Simple Logging Facade for Java (SLF4J)] framework using the
 `@Slf4j` annotation. Writing:
 
 [source,groovy]
@@ -2219,6 +2229,45 @@ is equivalent to writing:
 include::../test/LogImprovementsASTTransformsTest.groovy[tags=slf4j_equiv,indent=0]
 ----
 
+You still need to add the appropriate slf4j jar(s) to your classpath.
+
+[[xform-PlatformLog]]
+===== `@groovy.util.logging.PlatformLog`
+
+Groovy supports the https://openjdk.java.net/jeps/264[Java Platform Logging API and Service]
+framework using the `@PlatformLog` annotation. Writing:
+
+[source,groovy]
+----
+@groovy.util.logging.PlatformLog
+class Greeter {
+    void greet() {
+        log.info 'Called greeter'
+        println 'Hello, world!'
+    }
+}
+----
+
+is equivalent to writing:
+
+[source,groovy]
+----
+import java.lang.System.Logger
+import java.lang.System.LoggerFinder
+import static java.lang.System.Logger.Level.INFO
+
+class Greeter {
+    private static final transient Logger log =
+        LoggerFinder.loggerFinder.getLogger(Greeter.class.name, Greeter.class.module)
+    void greet() {
+        log.log INFO, 'Called greeter'
+        println 'Hello, world!'
+    }
+}
+----
+
+You need to be using JDK 9+ to use this capability.
+
 ==== Declarative concurrency
 
 The Groovy language provides a set of annotations aimed at simplifying common concurrency patterns in a declarative

[groovy] 01/05: GROOVY-10290: Dynamic Groovy code in Gradle doesn't compile because of $getLookup() method is not static

Posted by pa...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit c70f04e40121d3ea624184be30a05ac409caf3e0
Author: Paul King <pa...@asert.com.au>
AuthorDate: Tue Feb 15 23:05:50 2022 +1000

    GROOVY-10290: Dynamic Groovy code in Gradle doesn't compile because of $getLookup() method is not static
---
 .../groovy/tools/javac/JavaStubGenerator.java      |  2 +-
 .../groovy/tools/stubgenerator/Groovy10290.groovy  | 46 ++++++++++++++++++++++
 2 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java b/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
index 647c3f9..be10047 100644
--- a/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
+++ b/src/main/java/org/codehaus/groovy/tools/javac/JavaStubGenerator.java
@@ -707,7 +707,7 @@ public class JavaStubGenerator {
     private void printMethod(PrintWriter out, ClassNode clazz, MethodNode methodNode) {
         if (methodNode.isStaticConstructor()) return;
         if (methodNode.isPrivate() || !Utilities.isJavaIdentifier(methodNode.getName())) return;
-        if (methodNode.isSynthetic() && methodNode.getName().equals("$getStaticMetaClass")) return;
+        if (methodNode.isSynthetic() && (methodNode.getName().equals("$getStaticMetaClass") || methodNode.getName().equals("$getLookup"))) return;
 
         printAnnotations(out, methodNode);
         if (!isInterfaceOrTrait(clazz)) {
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy10290.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy10290.groovy
new file mode 100644
index 0000000..264f7eb
--- /dev/null
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy10290.groovy
@@ -0,0 +1,46 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.codehaus.groovy.tools.stubgenerator
+
+final class Groovy10290 extends StringSourcesStubTestCase {
+
+    @Override
+    Map<String, String> provideSources() {
+        [
+            'ResettableExpectations.java': '''
+                public interface ResettableExpectations { }
+            ''',
+            'SFTPServer.groovy': '''
+                class SFTPServer implements ResettableExpectations {
+                    static interface SftpExpectation { }
+                    @groovy.transform.CompileStatic
+                    static class SftpExpectOne implements SftpExpectation { }
+                    static class SftpExpectOnePath extends SftpExpectOne { }
+                    class SftpExpectOneOpen extends SftpExpectOnePath { }
+                }
+            '''
+        ]
+    }
+
+    @Override
+    void verifyStubs() {
+        String stub = stubJavaSourceFor('SFTPServer')
+        assert !stub.contains('$getLookup')
+    }
+}