You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2021/03/30 14:52:56 UTC

[groovy] 02/02: GROOVY-7989: add test case

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

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

commit 35b16b8e4f68e1d2f36a8fb1c70df2050f778a20
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Tue Mar 30 09:33:33 2021 -0500

    GROOVY-7989: add test case
---
 src/test/groovy/bugs/Groovy7989.groovy | 41 ++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/src/test/groovy/bugs/Groovy7989.groovy b/src/test/groovy/bugs/Groovy7989.groovy
new file mode 100644
index 0000000..e4594f7
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy7989.groovy
@@ -0,0 +1,41 @@
+/*
+ *  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 Groovy7989 {
+    @Test
+    void testListCloneInStaticInitializer() {
+        ['', '@groovy.transform.TypeChecked', '@groovy.transform.CompileStatic'].each { annotaion ->
+            assertScript """
+                $annotaion
+                class Main {
+                    static {
+                        List list = []
+                        list.clone()
+                    }
+                }
+                new Main()
+            """
+        }
+    }
+}