Skip to content

Commit 6d48464

Browse files
javadoc improvements (fixes #58)
1 parent 2fa8add commit 6d48464

File tree

1 file changed

+16
-6
lines changed
  • typescript-generator-core/src/main/java/cz/habarta/typescript/generator/parser

1 file changed

+16
-6
lines changed

typescript-generator-core/src/main/java/cz/habarta/typescript/generator/parser/Javadoc.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,18 +166,28 @@ private static Enum findJavadocEnum(java.lang.Class<?> cls, List<Root> dRoots) {
166166
return null;
167167
}
168168

169-
private List<String> getComments(String dComments, List<TagInfo> tags) {
170-
if (dComments == null) {
169+
private static List<String> getComments(String dComments, List<TagInfo> tags) {
170+
if (dComments == null && (tags == null || tags.isEmpty())) {
171171
return null;
172172
}
173-
final String[] lines = dComments.split("\\r\\n|\\n|\\r");
174173
final List<String> result = new ArrayList<>();
174+
if (dComments != null) {
175+
result.addAll(splitMultiline(dComments));
176+
}
177+
if (tags != null) {
178+
for (TagInfo tag : tags) {
179+
result.addAll(splitMultiline(tag.getName() + " " + tag.getText()));
180+
}
181+
}
182+
return result;
183+
}
184+
185+
private static List<String> splitMultiline(String comments) {
186+
final List<String> result = new ArrayList<>();
187+
final String[] lines = comments.split("\\r\\n|\\n|\\r");
175188
for (String line : lines) {
176189
result.add(line.trim());
177190
}
178-
for (TagInfo tag : tags) {
179-
result.add(tag.getName() + " " + tag.getText());
180-
}
181191
return result;
182192
}
183193

0 commit comments

Comments
 (0)