cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject cxf git commit: [CXF-6446] Updating JavaDocProvider to read operation descriptions with Java 8
Date Tue, 09 Jun 2015 11:33:18 GMT
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 8f94bfa9d -> 4626a863a


[CXF-6446] Updating JavaDocProvider to read operation descriptions with Java 8


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/4626a863
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/4626a863
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/4626a863

Branch: refs/heads/3.0.x-fixes
Commit: 4626a863a80156776c6048ac60838d62d0d458f1
Parents: 8f94bfa
Author: Sergey Beryozkin <sberyozkin@talend.com>
Authored: Tue Jun 9 12:31:16 2015 +0100
Committer: Sergey Beryozkin <sberyozkin@talend.com>
Committed: Tue Jun 9 12:33:00 2015 +0100

----------------------------------------------------------------------
 .../apache/cxf/jaxrs/model/wadl/JavaDocProvider.java  | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/4626a863/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
----------------------------------------------------------------------
diff --git a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
index 8970a40..e411459 100644
--- a/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
+++ b/rt/rs/description/src/main/java/org/apache/cxf/jaxrs/model/wadl/JavaDocProvider.java
@@ -40,6 +40,8 @@ import org.apache.cxf.jaxrs.utils.ResourceUtils;
 public class JavaDocProvider implements DocumentationProvider {
     public static final double JAVA_VERSION = getVersion();
     public static final double JAVA_VERSION_16 = 1.6D;
+    public static final double JAVA_VERSION_17 = 1.7D;
+    public static final double JAVA_VERSION_18 = 1.8D;
 
     private ClassLoader javaDocLoader;
     private ConcurrentHashMap<String, ClassDocs> docs = new ConcurrentHashMap<String,
ClassDocs>();
@@ -176,12 +178,13 @@ public class JavaDocProvider implements DocumentationProvider {
         MethodDocs mDocs = classDoc.getMethodDocs(method);
         if (mDocs == null) {
             String operLink = getOperLink();
-            String operMarker = operLink + method.getName() + "(";
+            String operMarker = operLink + method.getName() + getOperationMarkerOpen();
             
             int operMarkerIndex = classDoc.getClassDoc().indexOf(operMarker);
             while (operMarkerIndex != -1) { 
                 int startOfOpSigIndex = operMarkerIndex + operMarker.length();
-                int endOfOpSigIndex = classDoc.getClassDoc().indexOf(")", startOfOpSigIndex);
+                int endOfOpSigIndex = classDoc.getClassDoc().indexOf(getOperationMarkerClose(),

+                                                                     startOfOpSigIndex);
                 int paramLen = method.getParameterTypes().length;
                 if (endOfOpSigIndex == startOfOpSigIndex && paramLen == 0) {
                     break;
@@ -292,6 +295,13 @@ public class JavaDocProvider implements DocumentationProvider {
         return javaDocsBuiltByVersion == JAVA_VERSION_16 ? tag : tag.toLowerCase();
     }
     
+    protected String getOperationMarkerOpen() {
+        return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "--" : "(";
+    }
+    protected String getOperationMarkerClose() {
+        return javaDocsBuiltByVersion == JAVA_VERSION_18 ? "--" : ")";
+    }
+    
     public void setJavaDocsBuiltByVersion(String version) {
         javaDocsBuiltByVersion = Double.valueOf(version);
     }


Mime
View raw message