Skip to content

Commit de59aa8

Browse files
8020663: Restructure some properties to facilitate better translation
Reviewed-by: darcy
1 parent c9f3ced commit de59aa8

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -176,25 +176,32 @@ doclet.Value=Value
176176
doclet.0_and_1={0} and {1}
177177

178178
#Documentation for Enums
179-
doclet.enum_values_doc=\n\
179+
doclet.enum_values_doc.main=\n\
180180
Returns an array containing the constants of this enum type, in\n\
181181
the order they are declared. This method may be used to iterate\n\
182182
over the constants as follows:\n\
183183
<pre>\n\
184184
for ({0} c : {0}.values())\n\
185185
&nbsp; System.out.println(c);\n\
186-
</pre>\n\
187-
@return an array containing the constants of this enum type, in\n\
188-
the order they are declared
186+
</pre>
189187

190-
doclet.enum_valueof_doc=\n\
188+
doclet.enum_values_doc.return=\n\
189+
an array containing the constants of this enum type, in the order they are declared
190+
191+
doclet.enum_valueof_doc.main=\n\
191192
Returns the enum constant of this type with the specified name.\n\
192193
The string must match <i>exactly</i> an identifier used to declare an\n\
193194
enum constant in this type. (Extraneous whitespace characters are \n\
194-
not permitted.)\n\
195-
\n\
196-
@param name the name of the enum constant to be returned.\n\
197-
@return the enum constant with the specified name\n\
198-
@throws IllegalArgumentException if this enum type has no constant\n\
199-
with the specified name\n\
200-
@throws NullPointerException if the argument is null
195+
not permitted.)
196+
197+
doclet.enum_valueof_doc.param_name=\
198+
the name of the enum constant to be returned.
199+
200+
doclet.enum_valueof_doc.return=\
201+
the enum constant with the specified name
202+
203+
doclet.enum_valueof_doc.throws_ila=\
204+
if this enum type has no constant with the specified name
205+
206+
doclet.enum_valueof_doc.throws_npe=\
207+
if the argument is null

langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -667,16 +667,28 @@ public static void setEnumDocumentation(Configuration configuration,
667667
for (int j = 0; j < methods.length; j++) {
668668
MethodDoc currentMethod = methods[j];
669669
if (currentMethod.name().equals("values") &&
670-
currentMethod.parameters().length == 0) {
671-
currentMethod.setRawCommentText(
672-
configuration.getText("doclet.enum_values_doc", classDoc.name()));
670+
currentMethod.parameters().length == 0) {
671+
StringBuilder sb = new StringBuilder();
672+
sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
673+
sb.append("\n@return ");
674+
sb.append(configuration.getText("doclet.enum_values_doc.return"));
675+
currentMethod.setRawCommentText(sb.toString());
673676
} else if (currentMethod.name().equals("valueOf") &&
674-
currentMethod.parameters().length == 1) {
677+
currentMethod.parameters().length == 1) {
675678
Type paramType = currentMethod.parameters()[0].type();
676679
if (paramType != null &&
677-
paramType.qualifiedTypeName().equals(String.class.getName())) {
678-
currentMethod.setRawCommentText(
679-
configuration.getText("doclet.enum_valueof_doc"));
680+
paramType.qualifiedTypeName().equals(String.class.getName())) {
681+
StringBuilder sb = new StringBuilder();
682+
sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
683+
sb.append("\n@param name ");
684+
sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
685+
sb.append("\n@return ");
686+
sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
687+
sb.append("\n@throws IllegalArgumentException ");
688+
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
689+
sb.append("\n@throws NullPointerException ");
690+
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
691+
currentMethod.setRawCommentText(sb.toString());
680692
}
681693
}
682694
}

0 commit comments

Comments
 (0)