You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2017/10/19 12:02:04 UTC

groovy git commit: GROOVY-8343: Issue implementing Java interface

Repository: groovy
Updated Branches:
  refs/heads/master 57a68275e -> 3e74103ec


GROOVY-8343: Issue implementing Java interface


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/3e74103e
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/3e74103e
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/3e74103e

Branch: refs/heads/master
Commit: 3e74103ecf191ebde97996b3cb9818d945601fb2
Parents: 57a6827
Author: paulk <pa...@asert.com.au>
Authored: Thu Oct 19 22:01:52 2017 +1000
Committer: paulk <pa...@asert.com.au>
Committed: Thu Oct 19 22:01:52 2017 +1000

----------------------------------------------------------------------
 .../groovy/ast/tools/MethodNodeUtils.java       |  1 -
 .../stubgenerator/Groovy8343StubTest.groovy     | 52 ++++++++++++++++++++
 2 files changed, 52 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/3e74103e/src/main/org/apache/groovy/ast/tools/MethodNodeUtils.java
----------------------------------------------------------------------
diff --git a/src/main/org/apache/groovy/ast/tools/MethodNodeUtils.java b/src/main/org/apache/groovy/ast/tools/MethodNodeUtils.java
index b43fc31..94427f0 100644
--- a/src/main/org/apache/groovy/ast/tools/MethodNodeUtils.java
+++ b/src/main/org/apache/groovy/ast/tools/MethodNodeUtils.java
@@ -34,7 +34,6 @@ public class MethodNodeUtils {
      */
     public static String methodDescriptorWithoutReturnType(MethodNode mNode) {
         StringBuilder sb = new StringBuilder();
-        mNode.getTypeDescriptor();
         sb.append(mNode.getName()).append(':');
         for (Parameter p : mNode.getParameters()) {
             sb.append(ClassNodeUtils.formatTypeName(p.getType())).append(',');

http://git-wip-us.apache.org/repos/asf/groovy/blob/3e74103e/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy8343StubTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy8343StubTest.groovy b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy8343StubTest.groovy
new file mode 100644
index 0000000..a8bf83d
--- /dev/null
+++ b/src/test/org/codehaus/groovy/tools/stubgenerator/Groovy8343StubTest.groovy
@@ -0,0 +1,52 @@
+/*
+ *  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.tools.stubgenerator
+
+class Groovy8343StubTest extends StringSourcesStubTestCase {
+
+    @Override
+    Map<String, String> provideSources() {
+        [
+                'groovy/Groovy8343.java': '''
+                    package groovy;
+                    /**
+                     * Precompiled Java class in same package as Groovy8343Test
+                     */
+                    public interface Groovy8343 {
+                        Groovy8343 createRelative(String relativePath);
+                    }
+                ''',
+                'groovy/Groovy8343Test.groovy': '''
+                    package groovy
+                    @groovy.transform.CompileStatic
+                    class Groovy8343Impl implements Groovy8343 {
+                        Groovy8343 createRelative(String relativePath) {
+                            throw new UnsupportedOperationException("Method createRelative not supported")
+                        }
+                    }
+                    assert new Groovy8343Impl()
+                '''
+        ]
+    }
+
+    @Override
+    void verifyStubs() {
+        // We are just testing that the above compiles ok and using stub test to create the correct conditions
+    }
+}