You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by jw...@apache.org on 2016/01/25 21:04:26 UTC
[1/2] groovy git commit: Update junit javadoc links
Repository: groovy
Updated Branches:
refs/heads/master 57cb5e8da -> 82681baef
Update junit javadoc links
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/82681bae
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/82681bae
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/82681bae
Branch: refs/heads/master
Commit: 82681baefc7a1b217e2f855d286259bfeeffbd45
Parents: 2e7c69d
Author: John Wagenleitner <jw...@apache.org>
Authored: Mon Jan 25 11:40:35 2016 -0800
Committer: John Wagenleitner <jw...@apache.org>
Committed: Mon Jan 25 11:57:52 2016 -0800
----------------------------------------------------------------------
gradle/docs.gradle | 4 ++--
subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc | 4 ++--
.../src/test/resources/groovydoc/groovyDocTests.xml | 4 ++--
3 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/82681bae/gradle/docs.gradle
----------------------------------------------------------------------
diff --git a/gradle/docs.gradle b/gradle/docs.gradle
index a9bea4c..9be0a16 100644
--- a/gradle/docs.gradle
+++ b/gradle/docs.gradle
@@ -48,7 +48,7 @@ def javadocSpec = {
footer = doc.footer
source = rootProject.useIndy()?'1.7':'1.6'
links('http://docs.oracle.com/javase/8/docs/api/', 'http://docs.oracle.com/javaee/7/api/',
- 'http://commons.apache.org/proper/commons-cli/javadocs/api-release/', 'http://junit.org/apidocs/',
+ 'http://commons.apache.org/proper/commons-cli/javadocs/api-release/', 'http://junit.org/javadoc/latest/',
'http://docs.oracle.com/javaee/6/api/', 'http://www.antlr2.org/javadoc/')
}
}
@@ -66,7 +66,7 @@ def groovydocSpec = {
link 'http://docs.oracle.com/javaee/7/api/', 'javax.servlet.', 'javax.management.'
link 'http://docs.oracle.com/javase/8/docs/api/', 'java.', 'org.xml.', 'javax.', 'org.w3c.'
link 'http://docs.groovy-lang.org/docs/ant/api/', 'org.apache.ant.', 'org.apache.tools.ant.'
- link 'http://junit.org/apidocs/', 'org.junit.', 'junit.'
+ link 'http://junit.org/javadoc/latest/', 'org.junit.', 'junit.'
link 'http://www.antlr2.org/javadoc/', 'antlr.'
link 'http://commons.apache.org/proper/commons-cli/javadocs/api-release/', 'org.apache.commons.cli.'
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/82681bae/subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc b/subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc
index 7ae911d..8e7aa3b 100644
--- a/subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc
+++ b/subprojects/groovy-groovydoc/src/spec/doc/groovydoc.adoc
@@ -148,7 +148,7 @@ Create link to groovydoc/javadoc output at the given URL.
private = "false">
<link packages="java.,org.xml.,javax.,org.xml." href="http://docs.oracle.com/javase/8/docs/api/"/>
<link packages="org.apache.tools.ant." href="http://docs.groovy-lang.org/docs/ant/api/"/>
- <link packages="org.junit.,junit.framework." href="http://junit.org/apidocs/"/>
+ <link packages="org.junit.,junit.framework." href="http://junit.org/javadoc/latest/"/>
<link packages="groovy.,org.codehaus.groovy." href="http://docs.groovy-lang.org/latest/html/api/"/>
<link packages="org.codehaus.gmaven." href="http://groovy.github.io/gmaven/apidocs/"/>
</groovydoc>
@@ -175,7 +175,7 @@ ant.groovydoc(
link(packages:"java.,org.xml.,javax.,org.xml.",href:"http://docs.oracle.com/javase/8/docs/api/")
link(packages:"groovy.,org.codehaus.groovy.", href:"http://docs.groovy-lang.org/latest/html/api/")
link(packages:"org.apache.tools.ant.", href:"http://docs.groovy-lang.org/docs/ant/api/")
- link(packages:"org.junit.,junit.framework.", href:"http://junit.org/apidocs/")
+ link(packages:"org.junit.,junit.framework.", href:"http://junit.org/javadoc/latest/")
link(packages:"org.codehaus.gmaven.", href:"http://groovy.github.io/gmaven/apidocs/")
}
--------------------------------------------------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/82681bae/subprojects/groovy-groovydoc/src/test/resources/groovydoc/groovyDocTests.xml
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/test/resources/groovydoc/groovyDocTests.xml b/subprojects/groovy-groovydoc/src/test/resources/groovydoc/groovyDocTests.xml
index 360a8a6..bdefa96 100644
--- a/subprojects/groovy-groovydoc/src/test/resources/groovydoc/groovyDocTests.xml
+++ b/subprojects/groovy-groovydoc/src/test/resources/groovydoc/groovyDocTests.xml
@@ -37,7 +37,7 @@
use="true" windowtitle="GroovyDoc" private="false">
<link packages="java.,org.groovy.xml.,javax.,org.groovy.w3c." href="http://docs.oracle.com/javase/7/docs/api/"/>
<link packages="org.apache.tools.ant." href="http://docs.groovy-lang.org/docs/ant/api/"/>
- <link packages="org.junit.,junit.framework." href="http://junit.org/apidocs/"/>
+ <link packages="org.junit.,junit.framework." href="http://junit.org/javadoc/latest/"/>
<link packages="groovy.,org.codehaus.groovy." href="http://groovy.codehaus.org/api/"/>
<link packages="org.codehaus.gmaven." href="http://groovy.github.io/gmaven/apidocs/"/>
</groovydoc>
@@ -55,7 +55,7 @@
<link packages="java.,org.groovy.xml.,javax.,org.groovy.w3c." href="http://docs.oracle.com/javase/7/docs/api/"/>
<link packages="org.apache.tools.ant." href="http://docs.groovy-lang.org/docs/ant/api/"/>
- <link packages="org.junit.,junit.framework." href="http://junit.org/apidocs/"/>
+ <link packages="org.junit.,junit.framework." href="http://junit.org/javadoc/latest/"/>
<link packages="groovy.,org.codehaus.groovy." href="http://groovy.codehaus.org/api/"/>
<link packages="org.codehaus.gmaven." href="http://groovy.github.io/gmaven/apidocs/"/>
</groovydoc>
[2/2] groovy git commit: Fix groovydoc
processPropertiesFromGetterSetter build exceptions
Posted by jw...@apache.org.
Fix groovydoc processPropertiesFromGetterSetter build exceptions
Fixes StringIndexOutOfBoundsException if method name was exactly named [set/get/is] with no property name or NPE if classDoc was null.
Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/2e7c69dc
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/2e7c69dc
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/2e7c69dc
Branch: refs/heads/master
Commit: 2e7c69dc4d185dc790b7d15857235458ef3eb7a6
Parents: 57cb5e8
Author: John Wagenleitner <jw...@apache.org>
Authored: Mon Jan 25 11:02:10 2016 -0800
Committer: John Wagenleitner <jw...@apache.org>
Committed: Mon Jan 25 11:57:52 2016 -0800
----------------------------------------------------------------------
.../SimpleGroovyClassDocAssembler.java | 86 +++++++++++---------
1 file changed, 48 insertions(+), 38 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/groovy/blob/2e7c69dc/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
----------------------------------------------------------------------
diff --git a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
index cb9461d..44ded6b 100644
--- a/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
+++ b/subprojects/groovy-groovydoc/src/main/java/org/codehaus/groovy/tools/groovydoc/SimpleGroovyClassDocAssembler.java
@@ -268,51 +268,61 @@ public class SimpleGroovyClassDocAssembler extends VisitorAdapter implements Gro
private void processPropertiesFromGetterSetter(SimpleGroovyMethodDoc currentMethodDoc) {
String methodName = currentMethodDoc.name();
+ int len = methodName.length();
+ String prefix = null;
+ String propName = null;
+ if (len > 3 && methodName.startsWith("get")) {
+ prefix = "get";
+ propName = methodName.substring(3);
+ } else if (len > 3 && methodName.startsWith("set")) {
+ prefix = "set";
+ propName = methodName.substring(3);
+ } else if (len > 2 && methodName.startsWith("is")) {
+ prefix = "is";
+ propName = methodName.substring(2);
+ } else {
+ // Not a (get/set/is) method that contains a property name
+ return;
+ }
+
SimpleGroovyClassDoc classDoc = getCurrentClassDoc();
+ // TODO: not sure why but groovy.ui.view.BasicContentPane#buildOutputArea classDoc is null
+ if (classDoc == null) {
+ return;
+ }
GroovyMethodDoc methods[] = classDoc.methods();
- String setOrGet = methodName.substring(0, Math.min(methodName.length(), 3));
- if (setOrGet.equals("set") || setOrGet.equals("get") || setOrGet.startsWith("is")) {
-
- //find expected method name
- String expectedMethodName = null ;
- if (setOrGet.equals("set") && (currentMethodDoc.parameters().length >= 1 && !currentMethodDoc.parameters()[0].typeName().equals("boolean"))) {
- expectedMethodName = "get" + methodName.substring(3);
- } else if (setOrGet.equals("get") && !currentMethodDoc.returnType().typeName().equals("boolean")) {
- expectedMethodName = "set" + methodName.substring(3);
- } else if (setOrGet.startsWith("is")) {
- expectedMethodName = "set" + methodName.substring(2);
- } else {
- expectedMethodName = "is" + methodName.substring(3);
- }
-
- for (GroovyMethodDoc methodDoc : methods) {
- if (methodDoc.name().equals(expectedMethodName)) {
+ //find expected method name
+ String expectedMethodName = null;
+ if ("set".equals(prefix) && (currentMethodDoc.parameters().length >= 1 && !currentMethodDoc.parameters()[0].typeName().equals("boolean"))) {
+ expectedMethodName = "get" + propName;
+ } else if ("get".equals(prefix) && !currentMethodDoc.returnType().typeName().equals("boolean")) {
+ expectedMethodName = "set" + propName;
+ } else if ("is".equals(prefix)) {
+ expectedMethodName = "set" + propName;
+ } else {
+ expectedMethodName = "is" + propName;
+ }
- //extract the field name
- String fieldName = null;
- if (expectedMethodName.startsWith("set") && methodName.startsWith("is")) {
- fieldName = methodName.substring(2);
- } else {
- fieldName = methodName.substring(3);
- }
+ for (GroovyMethodDoc methodDoc : methods) {
+ if (methodDoc.name().equals(expectedMethodName)) {
- fieldName = fieldName.substring(0, 1).toLowerCase() + fieldName.substring(1);
- SimpleGroovyFieldDoc currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, classDoc);
+ //extract the field name
+ String fieldName = propName.substring(0, 1).toLowerCase() + propName.substring(1);
+ SimpleGroovyFieldDoc currentFieldDoc = new SimpleGroovyFieldDoc(fieldName, classDoc);
- //find the type of the field; if it's a setter, need to get the type of the params
- if(expectedMethodName.startsWith("set") && methodDoc.parameters().length >= 1) {
- String typeName = methodDoc.parameters()[0].typeName();
- currentFieldDoc.setType(new SimpleGroovyType(typeName));
- } else {
- //if it's not setter, get the type info of the return type of the get* method
- currentFieldDoc.setType(methodDoc.returnType());
- }
+ //find the type of the field; if it's a setter, need to get the type of the params
+ if(expectedMethodName.startsWith("set") && methodDoc.parameters().length >= 1) {
+ String typeName = methodDoc.parameters()[0].typeName();
+ currentFieldDoc.setType(new SimpleGroovyType(typeName));
+ } else {
+ //if it's not setter, get the type info of the return type of the get* method
+ currentFieldDoc.setType(methodDoc.returnType());
+ }
- if (methodDoc.isPublic() && currentMethodDoc.isPublic()) {
- classDoc.addProperty(currentFieldDoc);
- break;
- }
+ if (methodDoc.isPublic() && currentMethodDoc.isPublic()) {
+ classDoc.addProperty(currentFieldDoc);
+ break;
}
}
}