Skip to content

Commit a8d6335

Browse files
gselzerctrueden
authored andcommitted
Disable custom javadoc taglets for methods/classes
This ensures that everyone will be writing proper javadoc whenever proper javadoc will be sufficient for our purposes
1 parent f8e5cd0 commit a8d6335

2 files changed

Lines changed: 10 additions & 13 deletions

File tree

scijava/scijava-ops/src/main/java/org/scijava/param/JavadocParameterData.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,12 @@ private void parseMethod(Method m) {
148148
MethodJavadoc doc = RuntimeJavadoc.getJavadoc(m);
149149
long numOpParams = getOpParams(m);
150150
long numReturns = m.getReturnType() == void.class ? 0 : 1;
151-
// scrape the conventional javadoc tags iff present
152-
if (hasVanillaJavadoc(doc, numOpParams, numReturns))
153-
populateViaParamAndReturn(doc.getParams(), doc.getReturns());
154-
// scrape our custom javadoc taglets iff present
155-
else if (hasCustomJavadoc(doc.getOther(), numOpParams, 1))
156-
populateViaCustomTaglets(doc.getOther());
157-
// give up if neither is fully present
158-
else throw new IllegalArgumentException("Method " + m +
159-
" has no suitable tag(lets) to scrape documentation from");
151+
// ensure the method declares a complete set of tags
152+
if (!hasVanillaJavadoc(doc, numOpParams, numReturns))
153+
throw new IllegalArgumentException("Method " + m +
154+
" has no suitable tag(lets) to scrape documentation from");
155+
// scrape the conventional javadoc tags
156+
populateViaParamAndReturn(doc.getParams(), doc.getReturns());
160157
}
161158

162159
private long getOpParams(Method m) {
@@ -181,7 +178,7 @@ private boolean hasVanillaJavadoc(MethodJavadoc doc, long numParams, long numRet
181178
// We require a @param tag for each of the method parameters
182179
boolean sufficientParams = doc.getParams().size() == numParams;
183180
// We require a @return tag for the method return iff not null
184-
boolean javadocReturn = doc.getReturns() != null;
181+
boolean javadocReturn = !doc.getReturns().toString().isEmpty();
185182
boolean methodReturn = numReturns == 1;
186183
boolean sufficientReturn = javadocReturn == methodReturn;
187184
return sufficientParams && sufficientReturn;

scijava/scijava-ops/src/test/java/org/scijava/param/JavadocParameterTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void testJavadocMethodIO() {
112112
if (infos.hasNext()) {
113113
Assert.fail("Multiple OpInfos with name \"test.javadoc.method\"");
114114
}
115-
isSuitableScrapedOpMethodInfo(info);
115+
isSuitableGenericOpMethodInfo(info);
116116
}
117117

118118
@Test
@@ -140,7 +140,7 @@ public void testJavadocMethodI() {
140140
/**
141141
* Tests javadoc scraping of mutable taglet
142142
*
143-
* @mutable foo the i/o argument
143+
* @param foo the i/o argument
144144
*/
145145
@OpMethod(names = "test.javadoc.methodInplaceI", type = Inplaces.Arity1.class)
146146
public static void OpMethodInplaceI(List<String> foo) {
@@ -153,7 +153,7 @@ public static void OpMethodInplaceI(List<String> foo) {
153153
* Tests javadoc scraping of mutable taglet
154154
*
155155
* @dependency inplace the Op being wrapped
156-
* @mutable foo the i/o argument
156+
* @param foo the i/o argument
157157
*/
158158
@OpMethod(names = "test.javadoc.methodDependency", type = Inplaces.Arity1.class)
159159
public static void OpMethodInplaceI(@OpDependency(

0 commit comments

Comments
 (0)