Skip to content

Commit 8995919

Browse files
gselzerctrueden
authored andcommitted
Clean TODOs, output names
1 parent 31c983a commit 8995919

2 files changed

Lines changed: 7 additions & 12 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ public JavadocParameterData(Field f) {
9191
}
9292
}
9393

94-
// TODO: consider if we want to add more data to the {@link OpInfo}
95-
//
9694
public JavadocParameterData(OpInfo info, Type newType) {
9795
paramNames = new ArrayList<>();
9896
paramDescriptions = new ArrayList<>();
@@ -119,10 +117,8 @@ else if (sam.getParameterCount() < inputs.size()) {
119117
}
120118
for(Member<?> m : inputs) {
121119
paramNames.add(m.getKey());
122-
// TODO: Add member support for descriptions
123120
paramDescriptions.add(m.getDescription());
124121
}
125-
// TODO: Add member support for descriptions
126122
returnDescription = output.getDescription();
127123
}
128124

@@ -183,7 +179,7 @@ private void parseMethod(Method m) {
183179
public List<Parameter> synthesizeAnnotations(List<FunctionalMethodType> fmts) {
184180
List<Parameter> params = new ArrayList<>();
185181
int ins = 0;
186-
int outs = 1;
182+
int outs = 0;
187183

188184
Map<String, Object> paramValues = new HashMap<>();
189185
for (FunctionalMethodType fmt : fmts) {
@@ -200,7 +196,7 @@ public List<Parameter> synthesizeAnnotations(List<FunctionalMethodType> fmts) {
200196
break;
201197
case OUTPUT:
202198
// NB the @return tag does not provide a name, only a comment
203-
key = "output" + outs;
199+
key = "output" + (outs == 0 ? "" : outs);
204200
description = returnDescription;
205201
outs++;
206202
break;
@@ -230,7 +226,6 @@ public List<Parameter> synthesizeAnnotations(List<FunctionalMethodType> fmts) {
230226
+ "most likely an implementation error.", e);
231227
}
232228
}
233-
// TODO: consider if some error should be thrown when there are 2+ outputs
234229
return params;
235230
}
236231

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public void testJavadocMethod() {
6565

6666
// assert output name
6767
String outputName = info.output().getKey();
68-
Assert.assertEquals("output1", outputName);
68+
Assert.assertEquals("output", outputName);
6969

7070
// assert output description
7171
String outputDescription = info.output().getDescription();
@@ -103,7 +103,7 @@ public void testJavadocField() {
103103

104104
// assert output name
105105
String outputName = info.output().getKey();
106-
Assert.assertEquals("output1", outputName);
106+
Assert.assertEquals("output", outputName);
107107

108108
// assert output description
109109
String outputDescription = info.output().getDescription();
@@ -134,7 +134,7 @@ public void testJavadocClass() {
134134

135135
// assert output name
136136
String outputName = info.output().getKey();
137-
Assert.assertEquals("output1", outputName);
137+
Assert.assertEquals("output", outputName);
138138

139139
// assert output description
140140
String outputDescription = info.output().getDescription();
@@ -158,12 +158,12 @@ public void opStringRegressionTest() {
158158
" java.util.List<java.lang.String> foo -> the first input\n" +
159159
" java.util.List<java.lang.String> bar -> the second input\n" +
160160
" Outputs:\n" +
161-
" java.util.List<java.lang.Long> output1 -> foo + bar\n" + ")\n";
161+
" java.util.List<java.lang.Long> output -> foo + bar\n" + ")\n";
162162
String actual = info.toString();
163163
Assert.assertEquals(expected, actual);
164164

165165
// test special op string
166-
expected = "(java.util.List<java.lang.Long> output1 -> foo + bar) =\n" +
166+
expected = "(java.util.List<java.lang.Long> output -> foo + bar) =\n" +
167167
" public static java.util.List<java.lang.Long> org.scijava.param.JavadocParameterTest." +
168168
"OpMethodFoo(java.util.List<java.lang.String>,java.util.List<java.lang.String>)(\n" +
169169
" java.util.List<java.lang.String> foo -> the first input,\n" +

0 commit comments

Comments
 (0)