You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2020/09/06 10:57:56 UTC

[camel] 01/02: CAMEL-15478: Include APIs that has no return value (void)

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

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

commit ce527eee071c5b537dbeb5582afba62596129845
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Sun Sep 6 12:56:10 2020 +0200

    CAMEL-15478: Include APIs that has no return value (void)
---
 .../maven/JavaSourceApiMethodGeneratorMojo.java    | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceApiMethodGeneratorMojo.java b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceApiMethodGeneratorMojo.java
index 40599f2..c976e55 100644
--- a/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceApiMethodGeneratorMojo.java
+++ b/tooling/maven/camel-api-component-maven-plugin/src/main/java/org/apache/camel/maven/JavaSourceApiMethodGeneratorMojo.java
@@ -79,10 +79,15 @@ public class JavaSourceApiMethodGeneratorMojo extends AbstractApiMethodGenerator
              aClass = aClass.getSuperclass()) {
 
             log.debug("Processing " + aClass.getName());
-            final String sourcePath = aClass.getName().replace('.', '/') + ".java";
+            String sourcePath = aClass.getName();
+            int pos = sourcePath.indexOf('$');
+            if (pos != -1) {
+                sourcePath = sourcePath.substring(0, pos);
+            }
+            sourcePath = sourcePath.replace('.', '/') + ".java";
 
             // read source java text for class
-
+            log.debug("Loading source: " + sourcePath);
             try (InputStream inputStream = getProjectClassLoader().getResourceAsStream(sourcePath)) {
                 if (inputStream == null) {
                     log.debug("Java source not found on classpath for " + aClass.getName());
@@ -99,7 +104,6 @@ public class JavaSourceApiMethodGeneratorMojo extends AbstractApiMethodGenerator
                 }
 
                 // get public method signature
-                final Map<String, String> methodMap = parser.getMethodText();
                 for (String method : parser.getMethods()) {
                     if (!result.containsKey(method)
                             && (includeMethodPatterns == null || includeMethodPatterns.matcher(method).find())
@@ -108,15 +112,12 @@ public class JavaSourceApiMethodGeneratorMojo extends AbstractApiMethodGenerator
                         method = method.replace("public ", "");
                         int whitespace = method.indexOf(' ');
                         int leftBracket = method.indexOf('(');
-                        String resultType = method.substring(0, whitespace);
                         String name = method.substring(whitespace + 1, leftBracket);
-                        if (!"void".equals(resultType)) {
-                            SignatureModel model = new SignatureModel();
-                            model.setSignature(method);
-                            Map<String, String> params = parser.getParameters().get(name);
-                            model.setParameters(params);
-                            result.put(method, model);
-                        }
+                        SignatureModel model = new SignatureModel();
+                        model.setSignature(method);
+                        Map<String, String> params = parser.getParameters().get(name);
+                        model.setParameters(params);
+                        result.put(method, model);
                     }
                 }
             } catch (Exception e) {