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 2019/01/25 17:54:51 UTC

[groovy] branch master updated: Add a test for "GROOVY-3446: Method call resolves to statically imported method instead of equally named local method"

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 9b2386a  Add a test for "GROOVY-3446: Method call resolves to statically imported method instead of equally named local method"
9b2386a is described below

commit 9b2386a2278c288ca911dfb22f2a0d1015ccd565
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sat Jan 26 01:54:00 2019 +0800

    Add a test for "GROOVY-3446: Method call resolves to statically imported method instead of equally named local method"
---
 src/test/groovy/bugs/Groovy3446Bug.groovy | 32 +++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/src/test/groovy/bugs/Groovy3446Bug.groovy b/src/test/groovy/bugs/Groovy3446Bug.groovy
new file mode 100644
index 0000000..defc73b
--- /dev/null
+++ b/src/test/groovy/bugs/Groovy3446Bug.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 static java.lang.System.currentTimeMillis
+
+class Groovy3446Bug extends GroovyTestCase {
+    void testLocalMethodFavoredOverStaticallyImportedMethod() {
+        assert currentTimeMillis() == "local method called"
+    }
+
+    def currentTimeMillis() {
+        "local method called"
+    }
+}
+