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/12 17:32:58 UTC
[groovy] branch GROOVY_2_5_X updated: GROOVY-9882: add test case
This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch GROOVY_2_5_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/GROOVY_2_5_X by this push:
new 8e54039 GROOVY-9882: add test case
8e54039 is described below
commit 8e54039c250d9befcdca933172beb7f0a7db21f3
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Fri Mar 12 11:22:25 2021 -0600
GROOVY-9882: add test case
---
src/test/groovy/bugs/Groovy9982.groovy | 42 ++++++++++++++++++++++++++++++++++
1 file changed, 42 insertions(+)
diff --git a/src/test/groovy/bugs/Groovy9982.groovy b/src/test/groovy/bugs/Groovy9982.groovy
new file mode 100644
index 0000000..629d0ae
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy9982.groovy
@@ -0,0 +1,42 @@
+/*
+ * 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 Groovy9982 {
+ @Test
+ void testMethodAndPropertyWithSameName() {
+ assertScript '''
+ abstract class A {
+ def foo() { 'foo' }
+ }
+ class C extends A {
+ def foo = 'bar'
+ def test() {
+ foo = foo() // do not want ScriptBytecodeAdapter#invokeClosure
+ foo
+ }
+ }
+ assert new C().test() == 'foo'
+ '''
+ }
+}