You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2020/05/25 00:17:55 UTC

[groovy] branch GROOVY_3_0_X updated (6e49425 -> 94d039d)

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

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


    from 6e49425  GROOVY-9548: groovydoc: use property modifiers (closes #1252)
     new 872009b  GROOVY-9548: groovydoc: take property annotations from backing field
     new e770a32  Sonar: Replace the type specification in this constructor call with the diamond operator ("<>")
     new 94d039d  GROOVY-9566: Default import for Proxy is wrong (#1256)

The 3 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:
 src/main/java/org/codehaus/groovy/syntax/ASTHelper.java        | 10 +++++-----
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java       |  4 ++--
 src/test/groovy/bugs/{Groovy9010.groovy => Groovy9566.groovy}  | 10 +++-------
 .../main/java/org/apache/groovy/antlr/GroovydocVisitor.java    |  1 +
 .../org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java |  7 ++++++-
 5 files changed, 17 insertions(+), 15 deletions(-)
 copy src/test/groovy/bugs/{Groovy9010.groovy => Groovy9566.groovy} (83%)


[groovy] 01/03: GROOVY-9548: groovydoc: take property annotations from backing field

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

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

commit 872009b296b256eda2984a615a0289a7fd543ec1
Author: Mikko Värri <vm...@linuxbox.fi>
AuthorDate: Sat May 23 14:24:20 2020 +0300

    GROOVY-9548: groovydoc: take property annotations from backing field
    
    (cherry picked from commit ea4a0f8f0a58038d673626e2d1b3c428bb4bf5a0)
---
 .../src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java    | 1 +
 .../org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java     | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java
index 6f62ffc..1d7c940 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/apache/groovy/antlr/GroovydocVisitor.java
@@ -288,6 +288,7 @@ public class GroovydocVisitor extends ClassCodeVisitorSupport {
             fieldDoc.setRawCommentText(groovydoc == null ? "" : getDocContent(groovydoc));
             currentClassDoc.addProperty(fieldDoc);
         }
+        processAnnotations(fieldDoc, node.getField());
         super.visitProperty(node);
     }
 
diff --git a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
index b28e7d5..a252360 100644
--- a/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
+++ b/subprojects/groovy-groovydoc/src/test/groovy/org/codehaus/groovy/tools/groovydoc/GroovyDocToolTest.java
@@ -950,7 +950,12 @@ public class GroovyDocToolTest extends GroovyTestCase {
                         "<strong>annotatedField</strong></h4>"
         )).matcher(javadoc).find());
 
-        // TODO: Annotations for properties are missing, for some reason.
+        assertTrue("The Groovy property details should have the annotation", Pattern.compile(Pattern.quote(
+            "<h4>@<a href='https://docs.oracle.com/javase/8/docs/api/java/lang/Deprecated.html' title='Deprecated'>Deprecated</a>\n" +
+                "<a href='https://docs.oracle.com/javase/8/docs/api/java/util/List.html' title='List'>List</a> <strong>annotatedProperty</strong></h4>"
+        )).matcher(groovydoc).find());
+
+        // Java doesn't have properties section
 
         assertTrue("The Groovy ctor details should have the annotation", Pattern.compile(Pattern.quote(
                 "<h4>@groovy.transform.NamedVariant\n" +


[groovy] 02/03: Sonar: Replace the type specification in this constructor call with the diamond operator ("<>")

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

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

commit e770a32c20c2fdf55f633c15dea3dd537b46cf63
Author: Mariusz W <ma...@gmail.com>
AuthorDate: Sun May 24 17:27:02 2020 +0200

    Sonar: Replace the type specification in this constructor call with the diamond operator ("<>")
    
    (cherry picked from commit aa398d570f7680b1b9ed413ca4fb8e5e97919d02)
---
 src/main/java/org/codehaus/groovy/syntax/ASTHelper.java | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/syntax/ASTHelper.java b/src/main/java/org/codehaus/groovy/syntax/ASTHelper.java
index 978fba6..16da226 100644
--- a/src/main/java/org/codehaus/groovy/syntax/ASTHelper.java
+++ b/src/main/java/org/codehaus/groovy/syntax/ASTHelper.java
@@ -62,7 +62,7 @@ public class ASTHelper {
     }
 
     public void setPackageName(String packageName) {
-        setPackage(packageName, new ArrayList<AnnotationNode>());
+        setPackage(packageName, new ArrayList<>());
     }
 
     public PackageNode setPackage(String packageName, List<AnnotationNode> annotations) {
@@ -121,7 +121,7 @@ public class ASTHelper {
     }
 
     protected void addImport(ClassNode type, String name, String aliasName) {
-        addImport(type, name, aliasName, new ArrayList<AnnotationNode>());
+        addImport(type, name, aliasName, new ArrayList<>());
     }
 
     protected void addImport(ClassNode type, String name, String aliasName, List<AnnotationNode> annotations) {
@@ -130,7 +130,7 @@ public class ASTHelper {
     }
 
     protected void addStaticImport(ClassNode type, String name, String alias) {
-        addStaticImport(type, name, alias, new ArrayList<AnnotationNode>());
+        addStaticImport(type, name, alias, new ArrayList<>());
     }
 
     protected void addStaticImport(ClassNode type, String name, String alias, List<AnnotationNode> annotations) {
@@ -139,7 +139,7 @@ public class ASTHelper {
     }
 
     protected void addStaticStarImport(ClassNode type, String importClass) {
-        addStaticStarImport(type, importClass, new ArrayList<AnnotationNode>());
+        addStaticStarImport(type, importClass, new ArrayList<>());
     }
 
     protected void addStaticStarImport(ClassNode type, String importClass, List<AnnotationNode> annotations) {
@@ -147,7 +147,7 @@ public class ASTHelper {
     }
 
     protected void addStarImport(String importPackage) {
-        addStarImport(importPackage, new ArrayList<AnnotationNode>());
+        addStarImport(importPackage, new ArrayList<>());
     }
 
     protected void addStarImport(String importPackage, List<AnnotationNode> annotations) {


[groovy] 03/03: GROOVY-9566: Default import for Proxy is wrong (#1256)

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

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

commit 94d039d505835d9564c52d2a263b65b0456f2d5b
Author: Daniel.Sun <su...@apache.org>
AuthorDate: Mon May 25 08:15:30 2020 +0800

    GROOVY-9566: Default import for Proxy is wrong (#1256)
    
    (cherry picked from commit 850fee6145153ada724036d5e1fb7d75a327fe5d)
---
 .../org/codehaus/groovy/vmplugin/v9/Java9.java     |  4 +--
 src/test/groovy/bugs/Groovy9566.groovy             | 32 ++++++++++++++++++++++
 2 files changed, 34 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
index e635157..09b7b71 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -82,8 +82,6 @@ public class Java9 extends Java8 {
 
         Map<String, Set<String>> result = new LinkedHashMap<>(2048);
         try (GroovyClassLoader gcl = new GroovyClassLoader(this.getClass().getClassLoader())) {
-            result.putAll(doFindClasses(URI.create("jrt:/modules/java.base/"), "java", javaPns));
-
             URI gsLocation = DefaultGroovyMethods.getLocation(gcl.loadClass("groovy.lang.GroovySystem")).toURI();
             result.putAll(doFindClasses(gsLocation, "groovy", groovyPns));
 
@@ -93,6 +91,8 @@ public class Java9 extends Java8 {
             if (!gsLocation.equals(giLocation)) {
                 result.putAll(doFindClasses(giLocation, "groovy", groovyPns));
             }
+
+            result.putAll(doFindClasses(URI.create("jrt:/modules/java.base/"), "java", javaPns));
         } catch (Exception ignore) {
             if (LOGGER.isLoggable(Level.FINEST)) {
                 LOGGER.finest("[WARNING] Failed to find default imported classes:\n" + DefaultGroovyMethods.asString(ignore));
diff --git a/src/test/groovy/bugs/Groovy9566.groovy b/src/test/groovy/bugs/Groovy9566.groovy
new file mode 100644
index 0000000..8ab0156
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy9566.groovy
@@ -0,0 +1,32 @@
+/*
+ *  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 groovy.bugs
+
+import org.junit.Test
+
+import static groovy.test.GroovyAssert.assertScript
+
+final class Groovy9566 {
+    @Test
+    void testDefaultImportsWithSameClassName() {
+        assertScript '''
+            assert Proxy == java.net.Proxy
+        '''
+    }
+}