Skip to content

Commit 2bf2c26

Browse files
author
Lana Steuck
committed
Merge
2 parents 1962df5 + c7b90c0 commit 2bf2c26

File tree

74 files changed

+1311
-419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1311
-419
lines changed

langtools/src/share/classes/com/sun/source/tree/NewArrayTree.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525

2626
package com.sun.source.tree;
2727

28-
import java.util.List;
28+
import com.sun.tools.javac.util.List;
2929

3030
/**
3131
* A tree node for an expression to create a new instance of an array.
@@ -48,4 +48,6 @@ public interface NewArrayTree extends ExpressionTree {
4848
Tree getType();
4949
List<? extends ExpressionTree> getDimensions();
5050
List<? extends ExpressionTree> getInitializers();
51+
List<? extends AnnotationTree> getAnnotations();
52+
List<? extends List<? extends AnnotationTree>> getDimAnnotations();
5153
}

langtools/src/share/classes/com/sun/source/util/TreeScanner.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,10 @@ public R visitNewArray(NewArrayTree node, P p) {
285285
R r = scan(node.getType(), p);
286286
r = scanAndReduce(node.getDimensions(), p, r);
287287
r = scanAndReduce(node.getInitializers(), p, r);
288+
r = scanAndReduce(node.getAnnotations(), p, r);
289+
for (Iterable< ? extends Tree> dimAnno : node.getDimAnnotations()) {
290+
r = scanAndReduce(dimAnno, p, r);
291+
}
288292
return r;
289293
}
290294

langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractPackageIndexWriter.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ protected void addIndexContents(PackageDoc[] packages, String text,
159159
body.addContent(div);
160160
if (configuration.showProfiles) {
161161
Content profileSummary = configuration.getResource("doclet.Profiles");
162-
Content profilesTableSummary = configuration.getResource("doclet.Member_Table_Summary",
163-
configuration.getResource("doclet.Profile_Summary"),
164-
configuration.getResource("doclet.profiles"));
165-
addProfilesList(profileSummary, profilesTableSummary, body);
162+
addProfilesList(profileSummary, body);
166163
}
167164
addPackagesList(packages, text, tableSummary, body);
168165
}
@@ -214,10 +211,8 @@ protected void addAllProfilesLink(Content div) {
214211
* Do nothing. This will be overridden.
215212
*
216213
* @param profileSummary the profile summary heading
217-
* @param profilesTableSummary the profiles table summary information
218214
* @param body the content tree to which the profiles list will be added
219215
*/
220-
protected void addProfilesList(Content profileSummary, Content profilesTableSummary,
221-
Content body) {
216+
protected void addProfilesList(Content profileSummary, Content body) {
222217
}
223218
}

langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,16 @@
2525

2626
package com.sun.tools.doclets.formats.html;
2727

28-
import java.io.*;
29-
import java.util.*;
28+
import java.io.IOException;
29+
import java.util.ArrayList;
30+
import java.util.Collections;
31+
import java.util.HashMap;
32+
import java.util.Iterator;
33+
import java.util.List;
34+
import java.util.Map;
35+
import java.util.Set;
36+
import java.util.SortedSet;
37+
import java.util.TreeSet;
3038

3139
import com.sun.javadoc.*;
3240
import com.sun.tools.doclets.formats.html.markup.*;
@@ -95,7 +103,7 @@ public ClassUseWriter(ConfigurationImpl configuration,
95103
super(configuration, filename);
96104
this.classdoc = classdoc;
97105
if (mapper.classToPackageAnnotations.containsKey(classdoc.qualifiedName()))
98-
pkgToPackageAnnotations = new HashSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
106+
pkgToPackageAnnotations = new TreeSet<PackageDoc>(mapper.classToPackageAnnotations.get(classdoc.qualifiedName()));
99107
configuration.currentcd = classdoc;
100108
this.pkgSet = new TreeSet<PackageDoc>();
101109
this.pkgToClassTypeParameter = pkgDivide(mapper.classToClassTypeParam);

langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ protected Content getClassLink(LinkInfo linkInfo) {
109109
}
110110
}
111111
// Can't link so just write label.
112-
link.addContent(label.toString());
112+
link.addContent(label);
113113
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) {
114114
link.addContent(getTypeParameterLinks(linkInfo));
115115
}

langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java

Lines changed: 14 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,20 @@ protected void addIndex(Content body) {
123123
/**
124124
* {@inheritDoc}
125125
*/
126-
protected void addProfilesList(Content profileSummary, String profilesTableSummary,
127-
Content body) {
128-
Content table = HtmlTree.TABLE(HtmlStyle.overviewSummary, 0, 3, 0, profilesTableSummary,
129-
getTableCaption(profileSummary));
130-
table.addContent(getSummaryTableHeader(profileTableHeader, "col"));
131-
Content tbody = new HtmlTree(HtmlTag.TBODY);
132-
addProfilesList(tbody);
133-
table.addContent(tbody);
134-
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, table);
126+
protected void addProfilesList(Content profileSummary, Content body) {
127+
Content h2 = HtmlTree.HEADING(HtmlTag.H2, profileSummary);
128+
Content profilesDiv = HtmlTree.DIV(h2);
129+
Content ul = new HtmlTree(HtmlTag.UL);
130+
String profileName;
131+
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
132+
profileName = Profile.lookup(i).name;
133+
Content profileLinkContent = getTargetProfileLink("classFrame",
134+
new StringContent(profileName), profileName);
135+
Content li = HtmlTree.LI(profileLinkContent);
136+
ul.addContent(li);
137+
}
138+
profilesDiv.addContent(ul);
139+
Content div = HtmlTree.DIV(HtmlStyle.contentContainer, profilesDiv);
135140
body.addContent(div);
136141
}
137142

@@ -150,31 +155,6 @@ protected void addPackagesList(PackageDoc[] packages, String text,
150155
body.addContent(div);
151156
}
152157

153-
/**
154-
* Adds list of profiles in the index table. Generate link to each profile.
155-
*
156-
* @param tbody the documentation tree to which the list will be added
157-
*/
158-
protected void addProfilesList(Content tbody) {
159-
for (int i = 1; i < configuration.profiles.getProfileCount(); i++) {
160-
String profileName = Profile.lookup(i).name;
161-
Content profileLinkContent = getTargetProfileLink("classFrame",
162-
new StringContent(profileName), profileName);
163-
Content tdProfile = HtmlTree.TD(HtmlStyle.colFirst, profileLinkContent);
164-
HtmlTree tdSummary = new HtmlTree(HtmlTag.TD);
165-
tdSummary.addStyle(HtmlStyle.colLast);
166-
tdSummary.addContent(getSpace());
167-
HtmlTree tr = HtmlTree.TR(tdProfile);
168-
tr.addContent(tdSummary);
169-
if (i % 2 == 0) {
170-
tr.addStyle(HtmlStyle.altColor);
171-
} else {
172-
tr.addStyle(HtmlStyle.rowColor);
173-
}
174-
tbody.addContent(tr);
175-
}
176-
}
177-
178158
/**
179159
* Adds list of packages in the index table. Generate link to each package.
180160
*

langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTag.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525

2626
package com.sun.tools.doclets.formats.html.markup;
2727

28+
import java.util.Locale;
29+
2830
/**
2931
* Enum representing HTML tags.
3032
*
@@ -115,7 +117,7 @@ public static enum EndTag {
115117
HtmlTag(BlockType blockType, EndTag endTag ) {
116118
this.blockType = blockType;
117119
this.endTag = endTag;
118-
this.value = name().toLowerCase();
120+
this.value = name().toLowerCase(Locale.US);
119121
}
120122

121123
/**

langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ public StringContent(String initialContent) {
7070
* DocletAbortException because it
7171
* is not supported.
7272
*/
73+
@Override
7374
public void addContent(Content content) {
7475
throw new DocletAbortException();
7576
}
@@ -80,24 +81,28 @@ public void addContent(Content content) {
8081
*
8182
* @param strContent string content to be added
8283
*/
84+
@Override
8385
public void addContent(String strContent) {
8486
appendChars(strContent);
8587
}
8688

8789
/**
8890
* {@inheritDoc}
8991
*/
92+
@Override
9093
public boolean isEmpty() {
9194
return (stringContent.length() == 0);
9295
}
9396

97+
@Override
9498
public int charCount() {
9599
return RawHtml.charCount(stringContent.toString());
96100
}
97101

98102
/**
99103
* {@inheritDoc}
100104
*/
105+
@Override
101106
public String toString() {
102107
return stringContent.toString();
103108
}

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
}

langtools/src/share/classes/com/sun/tools/doclint/HtmlTag.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
import java.util.EnumMap;
3131
import java.util.EnumSet;
3232
import java.util.HashMap;
33+
import java.util.Locale;
3334
import java.util.Map;
3435

3536
import javax.lang.model.element.Name;
@@ -345,7 +346,7 @@ public static enum Attr {
345346
WIDTH;
346347

347348
public String getText() {
348-
return name().toLowerCase();
349+
return toLowerCase(name());
349350
}
350351

351352
static final Map<String,Attr> index = new HashMap<String,Attr>();
@@ -424,11 +425,11 @@ public boolean acceptsText() {
424425
}
425426

426427
public String getText() {
427-
return name().toLowerCase();
428+
return toLowerCase(name());
428429
}
429430

430431
public Attr getAttr(Name attrName) {
431-
return Attr.index.get(attrName.toString().toLowerCase());
432+
return Attr.index.get(toLowerCase(attrName.toString()));
432433
}
433434

434435
public AttrKind getAttrKind(Name attrName) {
@@ -450,6 +451,10 @@ private static AttrMap attrs(AttrKind k, Attr... attrs) {
450451
}
451452

452453
static HtmlTag get(Name tagName) {
453-
return index.get(tagName.toString().toLowerCase());
454+
return index.get(toLowerCase(tagName.toString()));
455+
}
456+
457+
private static String toLowerCase(String s) {
458+
return s.toLowerCase(Locale.US);
454459
}
455460
}

langtools/src/share/classes/com/sun/tools/javac/code/Attribute.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,14 @@ public <R, P> R accept(AnnotationValueVisitor<R, P> v, P p) {
340340
}
341341
}
342342

343+
public static class UnresolvedClass extends Error {
344+
public Type classType;
345+
public UnresolvedClass(Type type, Type classType) {
346+
super(type);
347+
this.classType = classType;
348+
}
349+
}
350+
343351
/** A visitor type for dynamic dispatch on the kind of attribute value. */
344352
public static interface Visitor {
345353
void visitConstant(Attribute.Constant value);

0 commit comments

Comments
 (0)