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/28 01:12:21 UTC

[groovy] branch GROOVY_3_0_X updated (3c0bf68 -> 1e93451)

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 3c0bf68  GROOVY-5259: refactor handling of "this" reference in special ctor call
     new 2d90547  GROOVY-9574: ConcurrentModificationException in Java9.concealedPackageList
     new 1e93451  GROOVY-9575

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:
 src/main/java/org/codehaus/groovy/ast/ASTNode.java      |  6 ------
 .../java/org/codehaus/groovy/vmplugin/v9/Java9.java     |  5 +++--
 .../MetaClassHelperTest.java => ast/ASTNodeTest.java}   | 17 +++++++++++------
 3 files changed, 14 insertions(+), 14 deletions(-)
 copy src/test/org/codehaus/groovy/{runtime/MetaClassHelperTest.java => ast/ASTNodeTest.java} (71%)


[groovy] 02/02: GROOVY-9575

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 1e93451821732a6d34b0e3b369e27dea59370368
Author: Anders Wallgren <aw...@cloudbees.com>
AuthorDate: Tue May 26 19:18:37 2020 -0700

    GROOVY-9575
    
    Remove unsuitable ASTNode.hashCode -- it does not conform to the Object
    .hashCode general contract.
    
    (cherry picked from commit eb8539f45daf1b980b99ddd824cb05ed2e14cc1f)
---
 src/main/java/org/codehaus/groovy/ast/ASTNode.java |  6 ----
 src/test/org/codehaus/groovy/ast/ASTNodeTest.java  | 33 ++++++++++++++++++++++
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/src/main/java/org/codehaus/groovy/ast/ASTNode.java b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
index 39b9f8c..66ccecf 100644
--- a/src/main/java/org/codehaus/groovy/ast/ASTNode.java
+++ b/src/main/java/org/codehaus/groovy/ast/ASTNode.java
@@ -18,7 +18,6 @@
  */
 package org.codehaus.groovy.ast;
 
-import java.util.Arrays;
 import java.util.Map;
 
 /**
@@ -121,9 +120,4 @@ public class ASTNode implements NodeMetaDataHandler {
     public void setMetaDataMap(Map<?, ?> metaDataMap) {
         this.metaDataMap = metaDataMap;
     }
-
-    @Override
-    public int hashCode() {
-        return Arrays.hashCode(new int[] {lineNumber, columnNumber, lastLineNumber, lastColumnNumber});
-    }
 }
diff --git a/src/test/org/codehaus/groovy/ast/ASTNodeTest.java b/src/test/org/codehaus/groovy/ast/ASTNodeTest.java
new file mode 100644
index 0000000..cb2b60e
--- /dev/null
+++ b/src/test/org/codehaus/groovy/ast/ASTNodeTest.java
@@ -0,0 +1,33 @@
+/*
+ *  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.ast;
+
+import junit.framework.TestCase;
+
+public class ASTNodeTest extends TestCase {
+
+    ASTNode astNode = new ASTNode();
+
+    public void testHashCode() {
+        int hashcode = astNode.hashCode();
+        
+        astNode.setLineNumber(astNode.getLineNumber() + 10);
+        assertEquals("hashCode is consistent", hashcode, astNode.hashCode());
+    }
+}


[groovy] 01/02: GROOVY-9574: ConcurrentModificationException in Java9.concealedPackageList

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 2d90547247fe2a36629f427be1a37bd4fd37e26c
Author: Daniel Sun <su...@apache.org>
AuthorDate: Thu May 28 09:00:40 2020 +0800

    GROOVY-9574: ConcurrentModificationException in Java9.concealedPackageList
    
    (cherry picked from commit d5dbeaf1d4689fb264a6d46c2e20b8ad54e34b86)
---
 src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java | 5 +++--
 1 file changed, 3 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 09b7b71..f875fa9 100644
--- a/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
+++ b/src/main/java/org/codehaus/groovy/vmplugin/v9/Java9.java
@@ -54,6 +54,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import java.util.stream.Collectors;
@@ -423,8 +424,8 @@ public class Java9 extends Java8 {
                 .map(ModuleReference::descriptor)
                 .forEach(md -> md.packages().forEach(pn -> map.putIfAbsent(pn, md)));
 
-        final Map<String, Set<String>> concealedPackagesToOpen = new HashMap<>();
-        final Map<String, Set<String>> exportedPackagesToOpen = new HashMap<>();
+        final Map<String, Set<String>> concealedPackagesToOpen = new ConcurrentHashMap<>();
+        final Map<String, Set<String>> exportedPackagesToOpen = new ConcurrentHashMap<>();
 
         Arrays.stream(JAVA8_PACKAGES())
                 .forEach(pn -> {