mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-14 12:25:21 +00:00
8030253: Update langtools to use strings-in-switch
8030262: Update langtools to use foreach loops 8030245: Update langtools to use try-with-resources and multi-catch Reviewed-by: darcy
This commit is contained in:
parent
bedae747dc
commit
dbcdc16212
@ -56,8 +56,7 @@ public class Attributes implements Iterable<Attribute> {
|
||||
public Attributes(ConstantPool constant_pool, Attribute[] attrs) {
|
||||
this.attrs = attrs;
|
||||
map = new HashMap<String,Attribute>();
|
||||
for (int i = 0; i < attrs.length; i++) {
|
||||
Attribute attr = attrs[i];
|
||||
for (Attribute attr : attrs) {
|
||||
try {
|
||||
map.put(attr.getName(constant_pool), attr);
|
||||
} catch (ConstantPoolException e) {
|
||||
|
||||
@ -57,11 +57,8 @@ public class ClassWriter {
|
||||
* Write a ClassFile data structure to a file.
|
||||
*/
|
||||
public void write(ClassFile classFile, File f) throws IOException {
|
||||
FileOutputStream f_out = new FileOutputStream(f);
|
||||
try {
|
||||
try (FileOutputStream f_out = new FileOutputStream(f)) {
|
||||
write(classFile, f_out);
|
||||
} finally {
|
||||
f_out.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -268,13 +268,13 @@ public abstract class AbstractExecutableMemberWriter extends AbstractMemberWrite
|
||||
|
||||
protected ClassDoc implementsMethodInIntfac(MethodDoc method,
|
||||
ClassDoc[] intfacs) {
|
||||
for (int i = 0; i < intfacs.length; i++) {
|
||||
MethodDoc[] methods = intfacs[i].methods();
|
||||
for (ClassDoc intf : intfacs) {
|
||||
MethodDoc[] methods = intf.methods();
|
||||
if (methods.length > 0) {
|
||||
for (int j = 0; j < methods.length; j++) {
|
||||
if (methods[j].name().equals(method.name()) &&
|
||||
methods[j].signature().equals(method.signature())) {
|
||||
return intfacs[i];
|
||||
for (MethodDoc md : methods) {
|
||||
if (md.name().equals(method.name()) &&
|
||||
md.signature().equals(method.signature())) {
|
||||
return intf;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -101,14 +101,13 @@ public class AbstractIndexWriter extends HtmlDocletWriter {
|
||||
// Display the list only if there are elements to be displayed.
|
||||
if (memberListSize > 0) {
|
||||
Content dl = new HtmlTree(HtmlTag.DL);
|
||||
for (int i = 0; i < memberListSize; i++) {
|
||||
Doc element = memberlist.get(i);
|
||||
for (Doc element : memberlist) {
|
||||
if (element instanceof MemberDoc) {
|
||||
addDescription((MemberDoc)element, dl);
|
||||
addDescription((MemberDoc) element, dl);
|
||||
} else if (element instanceof ClassDoc) {
|
||||
addDescription((ClassDoc)element, dl);
|
||||
addDescription((ClassDoc) element, dl);
|
||||
} else if (element instanceof PackageDoc) {
|
||||
addDescription((PackageDoc)element, dl);
|
||||
addDescription((PackageDoc) element, dl);
|
||||
}
|
||||
}
|
||||
contentTree.addContent(dl);
|
||||
|
||||
@ -87,14 +87,13 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
int size = list.size();
|
||||
if (size > 0) {
|
||||
Content ul = new HtmlTree(HtmlTag.UL);
|
||||
for (int i = 0; i < size; i++) {
|
||||
ClassDoc local = list.get(i);
|
||||
for (ClassDoc local : list) {
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addAttr(HtmlAttr.TYPE, LI_CIRCLE);
|
||||
addPartialInfo(local, li);
|
||||
addExtendsImplements(parent, local, li);
|
||||
addLevelInfo(local, classtree.subs(local, isEnum),
|
||||
isEnum, li); // Recurse
|
||||
isEnum, li); // Recurse
|
||||
ul.addContent(li);
|
||||
}
|
||||
contentTree.addContent(ul);
|
||||
@ -135,10 +134,10 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
if (interfaces.length > (cd.isInterface()? 1 : 0)) {
|
||||
Arrays.sort(interfaces);
|
||||
int counter = 0;
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
if (parent != interfaces[i]) {
|
||||
if (! (interfaces[i].isPublic() ||
|
||||
Util.isLinkable(interfaces[i], configuration))) {
|
||||
for (ClassDoc intf : interfaces) {
|
||||
if (parent != intf) {
|
||||
if (!(intf.isPublic() ||
|
||||
Util.isLinkable(intf, configuration))) {
|
||||
continue;
|
||||
}
|
||||
if (counter == 0) {
|
||||
@ -153,7 +152,7 @@ public abstract class AbstractTreeWriter extends HtmlDocletWriter {
|
||||
contentTree.addContent(", ");
|
||||
}
|
||||
addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE,
|
||||
interfaces[i], contentTree);
|
||||
intf, contentTree);
|
||||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,9 +150,9 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
* @param content HtmlTree content to which the links will be added
|
||||
*/
|
||||
protected void addContents(List<Doc> classlist, boolean wantFrames,
|
||||
Content content) {
|
||||
for (int i = 0; i < classlist.size(); i++) {
|
||||
ClassDoc cd = (ClassDoc)classlist.get(i);
|
||||
Content content) {
|
||||
for (Doc doc : classlist) {
|
||||
ClassDoc cd = (ClassDoc) doc;
|
||||
if (!Util.isCoreClass(cd)) {
|
||||
continue;
|
||||
}
|
||||
@ -160,7 +160,7 @@ public class AllClassesFrameWriter extends HtmlDocletWriter {
|
||||
Content linkContent;
|
||||
if (wantFrames) {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
|
||||
LinkInfoImpl.Kind.ALL_CLASSES_FRAME, cd).label(label).target("classFrame"));
|
||||
} else {
|
||||
linkContent = getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.DEFAULT, cd).label(label));
|
||||
}
|
||||
|
||||
@ -159,22 +159,20 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
public static void generate(ConfigurationImpl configuration,
|
||||
ClassTree classtree) {
|
||||
ClassUseMapper mapper = new ClassUseMapper(configuration.root, classtree);
|
||||
ClassDoc[] classes = configuration.root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
for (ClassDoc aClass : configuration.root.classes()) {
|
||||
// If -nodeprecated option is set and the containing package is marked
|
||||
// as deprecated, do not generate the class-use page. We will still generate
|
||||
// the class-use page if the class is marked as deprecated but the containing
|
||||
// package is not since it could still be linked from that package-use page.
|
||||
if (!(configuration.nodeprecated &&
|
||||
Util.isDeprecated(classes[i].containingPackage())))
|
||||
ClassUseWriter.generate(configuration, mapper, classes[i]);
|
||||
Util.isDeprecated(aClass.containingPackage())))
|
||||
ClassUseWriter.generate(configuration, mapper, aClass);
|
||||
}
|
||||
PackageDoc[] pkgs = configuration.packages;
|
||||
for (int i = 0; i < pkgs.length; i++) {
|
||||
for (PackageDoc pkg : configuration.packages) {
|
||||
// If -nodeprecated option is set and the package is marked
|
||||
// as deprecated, do not generate the package-use page.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pkgs[i])))
|
||||
PackageUseWriter.generate(configuration, mapper, pkgs[i]);
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
|
||||
PackageUseWriter.generate(configuration, mapper, pkg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -183,9 +181,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
List<? extends ProgramElementDoc> list= classMap.get(classdoc.qualifiedName());
|
||||
if (list != null) {
|
||||
Collections.sort(list);
|
||||
Iterator<? extends ProgramElementDoc> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
ProgramElementDoc doc = it.next();
|
||||
for (ProgramElementDoc doc : list) {
|
||||
PackageDoc pkg = doc.containingPackage();
|
||||
pkgSet.add(pkg);
|
||||
List<ProgramElementDoc> inPkg = map.get(pkg.name());
|
||||
@ -336,13 +332,12 @@ public class ClassUseWriter extends SubWriterHolderWriter {
|
||||
protected void addClassList(Content contentTree) throws IOException {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.addStyle(HtmlStyle.blockList);
|
||||
for (Iterator<PackageDoc> it = pkgSet.iterator(); it.hasNext();) {
|
||||
PackageDoc pkg = it.next();
|
||||
for (PackageDoc pkg : pkgSet) {
|
||||
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
|
||||
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
|
||||
classdoc)),
|
||||
getPackageLink(pkg, Util.getPackageName(pkg)));
|
||||
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
|
||||
classdoc)),
|
||||
getPackageLink(pkg, Util.getPackageName(pkg)));
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.SUMMARY_HEADING, link);
|
||||
li.addContent(heading);
|
||||
addClassUse(pkg, li);
|
||||
|
||||
@ -273,21 +273,20 @@ public class ClassWriterImpl extends SubWriterHolderWriter
|
||||
Type[] implIntfacs = classDoc.interfaceTypes();
|
||||
if (implIntfacs != null && implIntfacs.length > 0) {
|
||||
int counter = 0;
|
||||
for (int i = 0; i < implIntfacs.length; i++) {
|
||||
ClassDoc classDoc = implIntfacs[i].asClassDoc();
|
||||
if (! (classDoc.isPublic() ||
|
||||
Util.isLinkable(classDoc, configuration))) {
|
||||
for (Type implType : implIntfacs) {
|
||||
ClassDoc classDoc = implType.asClassDoc();
|
||||
if (!(classDoc.isPublic() || Util.isLinkable(classDoc, configuration))) {
|
||||
continue;
|
||||
}
|
||||
if (counter == 0) {
|
||||
pre.addContent(DocletConstants.NL);
|
||||
pre.addContent(isInterface? "extends " : "implements ");
|
||||
pre.addContent(isInterface ? "extends " : "implements ");
|
||||
} else {
|
||||
pre.addContent(", ");
|
||||
}
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
|
||||
implIntfacs[i]));
|
||||
LinkInfoImpl.Kind.CLASS_SIGNATURE_PARENT_NAME,
|
||||
implType));
|
||||
pre.addContent(link);
|
||||
counter++;
|
||||
}
|
||||
|
||||
@ -289,9 +289,9 @@ public class ConfigurationImpl extends Configuration {
|
||||
Map<String,PackageDoc> map = new HashMap<String,PackageDoc>();
|
||||
PackageDoc pd;
|
||||
ClassDoc[] classes = root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
pd = classes[i].containingPackage();
|
||||
if(! map.containsKey(pd.name())) {
|
||||
for (ClassDoc aClass : classes) {
|
||||
pd = aClass.containingPackage();
|
||||
if (!map.containsKey(pd.name())) {
|
||||
map.put(pd.name(), pd);
|
||||
}
|
||||
}
|
||||
@ -512,18 +512,17 @@ public class ConfigurationImpl extends Configuration {
|
||||
if (!nodeprecated) {
|
||||
return classarr[0];
|
||||
}
|
||||
for (int i = 0; i < classarr.length; i++) {
|
||||
if (classarr[i].tags("deprecated").length == 0) {
|
||||
return classarr[i];
|
||||
for (ClassDoc cd : classarr) {
|
||||
if (cd.tags("deprecated").length == 0) {
|
||||
return cd;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected boolean checkForDeprecation(RootDoc root) {
|
||||
ClassDoc[] classarr = root.classes();
|
||||
for (int i = 0; i < classarr.length; i++) {
|
||||
if (isGeneratedDoc(classarr[i])) {
|
||||
for (ClassDoc cd : root.classes()) {
|
||||
if (isGeneratedDoc(cd)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,9 +62,8 @@ public class ConstructorWriterImpl extends AbstractExecutableMemberWriter
|
||||
VisibleMemberMap visibleMemberMap = new VisibleMemberMap(classDoc,
|
||||
VisibleMemberMap.CONSTRUCTORS, configuration);
|
||||
List<ProgramElementDoc> constructors = new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
|
||||
for (int i = 0; i < constructors.size(); i++) {
|
||||
if ((constructors.get(i)).isProtected() ||
|
||||
(constructors.get(i)).isPrivate()) {
|
||||
for (ProgramElementDoc constructor : constructors) {
|
||||
if (constructor.isProtected() || constructor.isPrivate()) {
|
||||
setFoundNonPubConstructor(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -409,8 +409,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
head.addContent(meta);
|
||||
}
|
||||
if (metakeywords != null) {
|
||||
for (int i=0; i < metakeywords.length; i++) {
|
||||
Content meta = HtmlTree.META("keywords", metakeywords[i]);
|
||||
for (String metakeyword : metakeywords) {
|
||||
Content meta = HtmlTree.META("keywords", metakeyword);
|
||||
head.addContent(meta);
|
||||
}
|
||||
}
|
||||
@ -1013,9 +1013,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
public Content getPackageLink(PackageDoc pkg, Content label) {
|
||||
boolean included = pkg != null && pkg.isIncluded();
|
||||
if (! included) {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (packages[i].equals(pkg)) {
|
||||
for (PackageDoc p : configuration.packages) {
|
||||
if (p.equals(pkg)) {
|
||||
included = true;
|
||||
break;
|
||||
}
|
||||
@ -1714,7 +1713,7 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
//might be missing '>' character because the href has an inline tag.
|
||||
break;
|
||||
}
|
||||
if (textBuff.substring(begin, end).indexOf("\"") != -1){
|
||||
if (textBuff.substring(begin, end).contains("\"")){
|
||||
begin = textBuff.indexOf("\"", begin) + 1;
|
||||
end = textBuff.indexOf("\"", begin +1);
|
||||
if (begin == 0 || end == -1){
|
||||
@ -1947,15 +1946,15 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
boolean isJava5DeclarationLocation) {
|
||||
List<Content> results = new ArrayList<Content>();
|
||||
ContentBuilder annotation;
|
||||
for (int i = 0; i < descList.length; i++) {
|
||||
AnnotationTypeDoc annotationDoc = descList[i].annotationType();
|
||||
for (AnnotationDesc aDesc : descList) {
|
||||
AnnotationTypeDoc annotationDoc = aDesc.annotationType();
|
||||
// If an annotation is not documented, do not add it to the list. If
|
||||
// the annotation is of a repeatable type, and if it is not documented
|
||||
// and also if its container annotation is not documented, do not add it
|
||||
// to the list. If an annotation of a repeatable type is not documented
|
||||
// but its container is documented, it will be added to the list.
|
||||
if (! Util.isDocumentedAnnotation(annotationDoc) &&
|
||||
(!isAnnotationDocumented && !isContainerDocumented)) {
|
||||
if (!Util.isDocumentedAnnotation(annotationDoc) &&
|
||||
(!isAnnotationDocumented && !isContainerDocumented)) {
|
||||
continue;
|
||||
}
|
||||
/* TODO: check logic here to correctly handle declaration
|
||||
@ -1966,12 +1965,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
annotation = new ContentBuilder();
|
||||
isAnnotationDocumented = false;
|
||||
LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
|
||||
AnnotationDesc.ElementValuePair[] pairs = descList[i].elementValues();
|
||||
LinkInfoImpl.Kind.ANNOTATION, annotationDoc);
|
||||
AnnotationDesc.ElementValuePair[] pairs = aDesc.elementValues();
|
||||
// If the annotation is synthesized, do not print the container.
|
||||
if (descList[i].isSynthesized()) {
|
||||
for (int j = 0; j < pairs.length; j++) {
|
||||
AnnotationValue annotationValue = pairs[j].value();
|
||||
if (aDesc.isSynthesized()) {
|
||||
for (AnnotationDesc.ElementValuePair pair : pairs) {
|
||||
AnnotationValue annotationValue = pair.value();
|
||||
List<AnnotationValue> annotationTypeValues = new ArrayList<AnnotationValue>();
|
||||
if (annotationValue.value() instanceof AnnotationValue[]) {
|
||||
AnnotationValue[] annotationArray =
|
||||
@ -2008,12 +2007,12 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
// repeatable type annotation is not documented, print the container.
|
||||
else {
|
||||
addAnnotations(annotationDoc, linkInfo, annotation, pairs,
|
||||
indent, false);
|
||||
indent, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
addAnnotations(annotationDoc, linkInfo, annotation, pairs,
|
||||
indent, linkBreak);
|
||||
indent, linkBreak);
|
||||
}
|
||||
annotation.addContent(linkBreak ? DocletConstants.NL : "");
|
||||
results.add(annotation);
|
||||
@ -2085,8 +2084,8 @@ public class HtmlDocletWriter extends HtmlDocWriter {
|
||||
*/
|
||||
private boolean isAnnotationArray(AnnotationDesc.ElementValuePair[] pairs) {
|
||||
AnnotationValue annotationValue;
|
||||
for (int j = 0; j < pairs.length; j++) {
|
||||
annotationValue = pairs[j].value();
|
||||
for (AnnotationDesc.ElementValuePair pair : pairs) {
|
||||
annotationValue = pair.value();
|
||||
if (annotationValue.value() instanceof AnnotationValue[]) {
|
||||
AnnotationValue[] annotationArray =
|
||||
(AnnotationValue[]) annotationValue.value();
|
||||
|
||||
@ -360,8 +360,7 @@ public class MethodWriterImpl extends AbstractExecutableMemberWriter
|
||||
ImplementedMethods implementedMethodsFinder =
|
||||
new ImplementedMethods(method, writer.configuration);
|
||||
MethodDoc[] implementedMethods = implementedMethodsFinder.build();
|
||||
for (int i = 0; i < implementedMethods.length; i++) {
|
||||
MethodDoc implementedMeth = implementedMethods[i];
|
||||
for (MethodDoc implementedMeth : implementedMethods) {
|
||||
Type intfac = implementedMethodsFinder.getMethodHolder(implementedMeth);
|
||||
Content intfaclink = writer.getLink(new LinkInfoImpl(
|
||||
writer.configuration, LinkInfoImpl.Kind.METHOD_SPECIFIED_BY, intfac));
|
||||
|
||||
@ -167,25 +167,24 @@ public class PackageFrameWriter extends HtmlDocletWriter {
|
||||
boolean printedHeader = false;
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (documentedClasses != null &&
|
||||
!documentedClasses.contains(arr[i])) {
|
||||
for (ClassDoc classDoc : arr) {
|
||||
if (documentedClasses != null && !documentedClasses.contains(classDoc)) {
|
||||
continue;
|
||||
}
|
||||
if (!Util.isCoreClass(arr[i]) || !
|
||||
configuration.isGeneratedDoc(arr[i])) {
|
||||
if (!Util.isCoreClass(classDoc) || !configuration.isGeneratedDoc(classDoc)) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
true, labelContent);
|
||||
contentTree.addContent(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(arr[i].name());
|
||||
if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content arr_i_name = new StringContent(classDoc.name());
|
||||
if (classDoc.isInterface())
|
||||
arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, classDoc).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.addContent(li);
|
||||
}
|
||||
|
||||
@ -85,12 +85,12 @@ public class PackageIndexFrameWriter extends AbstractPackageIndexWriter {
|
||||
Content div = HtmlTree.DIV(HtmlStyle.indexContainer, heading);
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
for(int i = 0; i < packages.length; i++) {
|
||||
for (PackageDoc aPackage : packages) {
|
||||
// Do not list the package if -nodeprecated option is set and the
|
||||
// package is marked as deprecated.
|
||||
if (packages[i] != null &&
|
||||
(!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
|
||||
ul.addContent(getPackage(packages[i]));
|
||||
if (aPackage != null &&
|
||||
(!(configuration.nodeprecated && Util.isDeprecated(aPackage)))) {
|
||||
ul.addContent(getPackage(aPackage));
|
||||
}
|
||||
}
|
||||
div.addContent(ul);
|
||||
|
||||
@ -109,13 +109,12 @@ public class PackageIndexWriter extends AbstractPackageIndexWriter {
|
||||
* @param body the documentation tree to which the index will be added
|
||||
*/
|
||||
protected void addIndex(Content body) {
|
||||
for (int i = 0; i < groupList.size(); i++) {
|
||||
String groupname = groupList.get(i);
|
||||
List<PackageDoc> list = groupPackageMap.get(groupname);
|
||||
for (String groupname : groupList) {
|
||||
List<PackageDoc> list = groupPackageMap.get(groupname);
|
||||
if (list != null && list.size() > 0) {
|
||||
addIndexContents(list.toArray(new PackageDoc[list.size()]),
|
||||
groupname, configuration.getText("doclet.Member_Table_Summary",
|
||||
groupname, configuration.getText("doclet.packages")), body);
|
||||
groupname, configuration.getText("doclet.Member_Table_Summary",
|
||||
groupname, configuration.getText("doclet.packages")), body);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,16 +65,13 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
// by examining all classes in this package, find what packages
|
||||
// use these classes - produce a map between using package and
|
||||
// used classes.
|
||||
ClassDoc[] content = pkgdoc.allClasses();
|
||||
for (int i = 0; i < content.length; ++i) {
|
||||
ClassDoc usedClass = content[i];
|
||||
for (ClassDoc usedClass : pkgdoc.allClasses()) {
|
||||
Set<ClassDoc> usingClasses = mapper.classToClass.get(usedClass.qualifiedName());
|
||||
if (usingClasses != null) {
|
||||
for (Iterator<ClassDoc> it = usingClasses.iterator(); it.hasNext(); ) {
|
||||
ClassDoc usingClass = it.next();
|
||||
for (ClassDoc usingClass : usingClasses) {
|
||||
PackageDoc usingPackage = usingClass.containingPackage();
|
||||
Set<ClassDoc> usedClasses = usingPackageToUsedClasses
|
||||
.get(usingPackage.name());
|
||||
.get(usingPackage.name());
|
||||
if (usedClasses == null) {
|
||||
usedClasses = new TreeSet<ClassDoc>();
|
||||
usingPackageToUsedClasses.put(Util.getPackageName(usingPackage),
|
||||
@ -185,9 +182,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
configuration.getText("doclet.Class"),
|
||||
configuration.getText("doclet.Description"))
|
||||
};
|
||||
Iterator<String> itp = usingPackageToUsedClasses.keySet().iterator();
|
||||
while (itp.hasNext()) {
|
||||
String packageName = itp.next();
|
||||
for (String packageName : usingPackageToUsedClasses.keySet()) {
|
||||
PackageDoc usingPackage = configuration.root.packageNamed(packageName);
|
||||
HtmlTree li = new HtmlTree(HtmlTag.LI);
|
||||
li.addStyle(HtmlStyle.blockList);
|
||||
@ -195,12 +190,12 @@ public class PackageUseWriter extends SubWriterHolderWriter {
|
||||
li.addContent(getMarkerAnchor(usingPackage.name()));
|
||||
}
|
||||
String tableSummary = configuration.getText("doclet.Use_Table_Summary",
|
||||
configuration.getText("doclet.classes"));
|
||||
configuration.getText("doclet.classes"));
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.useSummary, 0, 3, 0, tableSummary,
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_Classes.in.0.used.by.1",
|
||||
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
|
||||
getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
|
||||
getTableCaption(configuration.getResource(
|
||||
"doclet.ClassUse_Classes.in.0.used.by.1",
|
||||
getPackageLink(pkgdoc, Util.getPackageName(pkgdoc)),
|
||||
getPackageLink(usingPackage, Util.getPackageName(usingPackage)))));
|
||||
table.addContent(getSummaryTableHeader(classTableHeader, "col"));
|
||||
Content tbody = new HtmlTree(HtmlTag.TBODY);
|
||||
Iterator<ClassDoc> itc =
|
||||
|
||||
@ -159,24 +159,25 @@ public class ProfilePackageFrameWriter extends HtmlDocletWriter {
|
||||
boolean printedHeader = false;
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(labelContent);
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
if (!isTypeInProfile(arr[i], profileValue)) {
|
||||
for (ClassDoc classDoc : arr) {
|
||||
if (!isTypeInProfile(classDoc, profileValue)) {
|
||||
continue;
|
||||
}
|
||||
if (!Util.isCoreClass(arr[i]) || !
|
||||
configuration.isGeneratedDoc(arr[i])) {
|
||||
if (!Util.isCoreClass(classDoc) || !
|
||||
configuration.isGeneratedDoc(classDoc)) {
|
||||
continue;
|
||||
}
|
||||
if (!printedHeader) {
|
||||
Content heading = HtmlTree.HEADING(HtmlConstants.CONTENT_HEADING,
|
||||
true, labelContent);
|
||||
true, labelContent);
|
||||
contentTree.addContent(heading);
|
||||
printedHeader = true;
|
||||
}
|
||||
Content arr_i_name = new StringContent(arr[i].name());
|
||||
if (arr[i].isInterface()) arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content arr_i_name = new StringContent(classDoc.name());
|
||||
if (classDoc.isInterface())
|
||||
arr_i_name = HtmlTree.SPAN(HtmlStyle.interfaceName, arr_i_name);
|
||||
Content link = getLink(new LinkInfoImpl(configuration,
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, arr[i]).label(arr_i_name).target("classFrame"));
|
||||
LinkInfoImpl.Kind.PACKAGE_FRAME, classDoc).label(arr_i_name).target("classFrame"));
|
||||
Content li = HtmlTree.LI(link);
|
||||
ul.addContent(li);
|
||||
}
|
||||
|
||||
@ -93,9 +93,9 @@ public class ProfilePackageIndexFrameWriter extends AbstractProfileIndexWriter {
|
||||
HtmlTree ul = new HtmlTree(HtmlTag.UL);
|
||||
ul.setTitle(packagesLabel);
|
||||
PackageDoc[] packages = configuration.profilePackages.get(profileName);
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if ((!(configuration.nodeprecated && Util.isDeprecated(packages[i])))) {
|
||||
ul.addContent(getPackage(packages[i], profileName));
|
||||
for (PackageDoc packageDoc : packages) {
|
||||
if ((!(configuration.nodeprecated && Util.isDeprecated(packageDoc)))) {
|
||||
ul.addContent(getPackage(packageDoc, profileName));
|
||||
}
|
||||
}
|
||||
div.addContent(ul);
|
||||
|
||||
@ -95,21 +95,19 @@ public class SourceToHTMLConverter {
|
||||
if (rootDoc == null || outputdir == null) {
|
||||
return;
|
||||
}
|
||||
PackageDoc[] pds = rootDoc.specifiedPackages();
|
||||
for (int i = 0; i < pds.length; i++) {
|
||||
for (PackageDoc pd : rootDoc.specifiedPackages()) {
|
||||
// If -nodeprecated option is set and the package is marked as deprecated,
|
||||
// do not convert the package files to HTML.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pds[i])))
|
||||
convertPackage(pds[i], outputdir);
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pd)))
|
||||
convertPackage(pd, outputdir);
|
||||
}
|
||||
ClassDoc[] cds = rootDoc.specifiedClasses();
|
||||
for (int i = 0; i < cds.length; i++) {
|
||||
for (ClassDoc cd : rootDoc.specifiedClasses()) {
|
||||
// If -nodeprecated option is set and the class is marked as deprecated
|
||||
// or the containing package is deprecated, do not convert the
|
||||
// package files to HTML.
|
||||
if (!(configuration.nodeprecated &&
|
||||
(Util.isDeprecated(cds[i]) || Util.isDeprecated(cds[i].containingPackage()))))
|
||||
convertClass(cds[i], outputdir);
|
||||
(Util.isDeprecated(cd) || Util.isDeprecated(cd.containingPackage()))))
|
||||
convertClass(cd, outputdir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -123,14 +121,13 @@ public class SourceToHTMLConverter {
|
||||
if (pd == null) {
|
||||
return;
|
||||
}
|
||||
ClassDoc[] cds = pd.allClasses();
|
||||
for (int i = 0; i < cds.length; i++) {
|
||||
for (ClassDoc cd : pd.allClasses()) {
|
||||
// If -nodeprecated option is set and the class is marked as deprecated,
|
||||
// do not convert the package files to HTML. We do not check for
|
||||
// containing package deprecation since it is already check in
|
||||
// the calling method above.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(cds[i])))
|
||||
convertClass(cds[i], outputdir);
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(cd)))
|
||||
convertClass(cd, outputdir);
|
||||
}
|
||||
}
|
||||
|
||||
@ -161,7 +158,6 @@ public class SourceToHTMLConverter {
|
||||
return;
|
||||
r = new FileReader(file);
|
||||
}
|
||||
LineNumberReader reader = new LineNumberReader(r);
|
||||
int lineno = 1;
|
||||
String line;
|
||||
relativePath = DocPaths.SOURCE_OUTPUT
|
||||
@ -169,14 +165,12 @@ public class SourceToHTMLConverter {
|
||||
.invert();
|
||||
Content body = getHeader();
|
||||
Content pre = new HtmlTree(HtmlTag.PRE);
|
||||
try {
|
||||
try (LineNumberReader reader = new LineNumberReader(r)) {
|
||||
while ((line = reader.readLine()) != null) {
|
||||
addLineNo(pre, lineno);
|
||||
addLine(pre, line, lineno);
|
||||
lineno++;
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
addBlankLines(pre);
|
||||
Content div = HtmlTree.DIV(HtmlStyle.sourceContainer, pre);
|
||||
@ -204,11 +198,8 @@ public class SourceToHTMLConverter {
|
||||
Content htmlDocument = new HtmlDocument(htmlDocType, htmlTree);
|
||||
configuration.message.notice("doclet.Generating_0", path.getPath());
|
||||
DocFile df = DocFile.createFileForOutput(configuration, path);
|
||||
Writer w = df.openWriter();
|
||||
try {
|
||||
try (Writer w = df.openWriter()) {
|
||||
htmlDocument.write(w, true);
|
||||
} finally {
|
||||
w.close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -95,8 +95,8 @@ public abstract class SubWriterHolderWriter extends HtmlDocletWriter {
|
||||
Content table = HtmlTree.TABLE(HtmlStyle.memberSummary, 0, 3, 0,
|
||||
mw.getTableSummary(), caption);
|
||||
table.addContent(getSummaryTableHeader(mw.getSummaryTableHeader(cd), "col"));
|
||||
for (int i = 0; i < tableContents.size(); i++) {
|
||||
table.addContent(tableContents.get(i));
|
||||
for (Content tableContent : tableContents) {
|
||||
table.addContent(tableContent);
|
||||
}
|
||||
return table;
|
||||
}
|
||||
|
||||
@ -197,9 +197,9 @@ public class TagletWriterImpl extends TagletWriter {
|
||||
public Content seeTagOutput(Doc holder, SeeTag[] seeTags) {
|
||||
ContentBuilder body = new ContentBuilder();
|
||||
if (seeTags.length > 0) {
|
||||
for (int i = 0; i < seeTags.length; ++i) {
|
||||
for (SeeTag seeTag : seeTags) {
|
||||
appendSeparatorIfNotEmpty(body);
|
||||
body.addContent(htmlWriter.seeTagToContent(seeTags[i]));
|
||||
body.addContent(htmlWriter.seeTagToContent(seeTag));
|
||||
}
|
||||
}
|
||||
if (holder.isField() && ((FieldDoc)holder).constantValue() != null &&
|
||||
|
||||
@ -196,10 +196,8 @@ public class HtmlTree extends Content {
|
||||
}
|
||||
|
||||
private static String encodeURL(String url) {
|
||||
byte[] urlBytes = url.getBytes(Charset.forName("UTF-8"));
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < urlBytes.length; i++) {
|
||||
int c = urlBytes[i];
|
||||
for (byte c : url.getBytes(Charset.forName("UTF-8"))) {
|
||||
if (NONENCODING_CHARS.get(c & 0xFF)) {
|
||||
sb.append((char) c);
|
||||
} else {
|
||||
|
||||
@ -188,8 +188,8 @@ public abstract class AbstractDoclet {
|
||||
protected void generateClassFiles(RootDoc root, ClassTree classtree) {
|
||||
generateClassFiles(classtree);
|
||||
PackageDoc[] packages = root.specifiedPackages();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
generateClassFiles(packages[i].allClasses(), classtree);
|
||||
for (PackageDoc pkg : packages) {
|
||||
generateClassFiles(pkg.allClasses(), classtree);
|
||||
}
|
||||
}
|
||||
|
||||
@ -200,10 +200,9 @@ public abstract class AbstractDoclet {
|
||||
*/
|
||||
private void generateClassFiles(ClassTree classtree) {
|
||||
String[] packageNames = configuration.classDocCatalog.packageNames();
|
||||
for (int packageNameIndex = 0; packageNameIndex < packageNames.length;
|
||||
packageNameIndex++) {
|
||||
for (String packageName : packageNames) {
|
||||
generateClassFiles(configuration.classDocCatalog.allClasses(
|
||||
packageNames[packageNameIndex]), classtree);
|
||||
packageName), classtree);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -339,38 +339,39 @@ public abstract class Configuration {
|
||||
*/
|
||||
public int optionLength(String option) {
|
||||
option = StringUtils.toLowerCase(option);
|
||||
if (option.equals("-author") ||
|
||||
option.equals("-docfilessubdirs") ||
|
||||
option.equals("-javafx") ||
|
||||
option.equals("-keywords") ||
|
||||
option.equals("-linksource") ||
|
||||
option.equals("-nocomment") ||
|
||||
option.equals("-nodeprecated") ||
|
||||
option.equals("-nosince") ||
|
||||
option.equals("-notimestamp") ||
|
||||
option.equals("-quiet") ||
|
||||
option.equals("-xnodate") ||
|
||||
option.equals("-version")) {
|
||||
return 1;
|
||||
} else if (option.equals("-d") ||
|
||||
option.equals("-docencoding") ||
|
||||
option.equals("-encoding") ||
|
||||
option.equals("-excludedocfilessubdir") ||
|
||||
option.equals("-link") ||
|
||||
option.equals("-sourcetab") ||
|
||||
option.equals("-noqualifier") ||
|
||||
option.equals("-output") ||
|
||||
option.equals("-sourcepath") ||
|
||||
option.equals("-tag") ||
|
||||
option.equals("-taglet") ||
|
||||
option.equals("-tagletpath") ||
|
||||
option.equals("-xprofilespath")) {
|
||||
return 2;
|
||||
} else if (option.equals("-group") ||
|
||||
option.equals("-linkoffline")) {
|
||||
return 3;
|
||||
} else {
|
||||
return -1; // indicate we don't know about it
|
||||
switch (option) {
|
||||
case "-author":
|
||||
case "-docfilessubdirs":
|
||||
case "-javafx":
|
||||
case "-keywords":
|
||||
case "-linksource":
|
||||
case "-nocomment":
|
||||
case "-nodeprecated":
|
||||
case "-nosince":
|
||||
case "-notimestamp":
|
||||
case "-quiet":
|
||||
case "-xnodate":
|
||||
case "-version":
|
||||
return 1;
|
||||
case "-d":
|
||||
case "-docencoding":
|
||||
case "-encoding":
|
||||
case "-excludedocfilessubdir":
|
||||
case "-link":
|
||||
case "-sourcetab":
|
||||
case "-noqualifier":
|
||||
case "-output":
|
||||
case "-sourcepath":
|
||||
case "-tag":
|
||||
case "-taglet":
|
||||
case "-tagletpath":
|
||||
case "-xprofilespath":
|
||||
return 2;
|
||||
case "-group":
|
||||
case "-linkoffline":
|
||||
return 3;
|
||||
default:
|
||||
return -1; // indicate we don't know about it
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,9 +435,8 @@ public abstract class Configuration {
|
||||
|
||||
private void initPackageArray() {
|
||||
Set<PackageDoc> set = new HashSet<PackageDoc>(Arrays.asList(root.specifiedPackages()));
|
||||
ClassDoc[] classes = root.specifiedClasses();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
set.add(classes[i].containingPackage());
|
||||
for (ClassDoc aClass : root.specifiedClasses()) {
|
||||
set.add(aClass.containingPackage());
|
||||
}
|
||||
ArrayList<PackageDoc> results = new ArrayList<PackageDoc>(set);
|
||||
Collections.sort(results);
|
||||
@ -453,8 +453,7 @@ public abstract class Configuration {
|
||||
|
||||
// Some options, specifically -link and -linkoffline, require that
|
||||
// the output directory has already been created: so do that first.
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
for (String[] os : options) {
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-d")) {
|
||||
destDirName = addTrailingFileSep(os[1]);
|
||||
@ -464,8 +463,7 @@ public abstract class Configuration {
|
||||
}
|
||||
}
|
||||
|
||||
for (int oi = 0; oi < options.length; ++oi) {
|
||||
String[] os = options[oi];
|
||||
for (String[] os : options) {
|
||||
String opt = StringUtils.toLowerCase(os[0]);
|
||||
if (opt.equals("-docfilessubdirs")) {
|
||||
copydocfilesubdirs = true;
|
||||
@ -588,15 +586,13 @@ public abstract class Configuration {
|
||||
tagletManager = tagletManager == null ?
|
||||
new TagletManager(nosince, showversion, showauthor, javafx, message) :
|
||||
tagletManager;
|
||||
String[] args;
|
||||
for (Iterator<String[]> it = customTagStrs.iterator(); it.hasNext(); ) {
|
||||
args = it.next();
|
||||
for (String[] args : customTagStrs) {
|
||||
if (args[0].equals("-taglet")) {
|
||||
tagletManager.addCustomTag(args[1], getFileManager(), tagletpath);
|
||||
continue;
|
||||
}
|
||||
String[] tokens = tokenize(args[1],
|
||||
TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
|
||||
TagletManager.SIMPLE_TAGLET_OPT_SEPARATOR, 3);
|
||||
if (tokens.length == 1) {
|
||||
String tagName = args[1];
|
||||
if (tagletManager.isKnownCustomTag(tagName)) {
|
||||
|
||||
@ -151,13 +151,12 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
*/
|
||||
public void buildContents(XMLNode node, Content contentTree) {
|
||||
Content contentListTree = writer.getContentsHeader();
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
printedPackageHeaders = new HashSet<String>();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (hasConstantField(packages[i]) && ! hasPrintedPackageIndex(packages[i].name())) {
|
||||
writer.addLinkToPackageContent(packages[i],
|
||||
parsePackageName(packages[i].name()),
|
||||
printedPackageHeaders, contentListTree);
|
||||
for (PackageDoc pkg : configuration.packages) {
|
||||
if (hasConstantField(pkg) && !hasPrintedPackageIndex(pkg.name())) {
|
||||
writer.addLinkToPackageContent(pkg,
|
||||
parsePackageName(pkg.name()),
|
||||
printedPackageHeaders, contentListTree);
|
||||
}
|
||||
}
|
||||
contentTree.addContent(writer.getContentsList(contentListTree));
|
||||
@ -170,12 +169,11 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
* @param contentTree the tree to which the summaries will be added
|
||||
*/
|
||||
public void buildConstantSummaries(XMLNode node, Content contentTree) {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
printedPackageHeaders = new HashSet<String>();
|
||||
Content summariesTree = writer.getConstantSummaries();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
if (hasConstantField(packages[i])) {
|
||||
currentPackage = packages[i];
|
||||
for (PackageDoc aPackage : configuration.packages) {
|
||||
if (hasConstantField(aPackage)) {
|
||||
currentPackage = aPackage;
|
||||
//Build the documentation for the current package.
|
||||
buildChildren(node, summariesTree);
|
||||
}
|
||||
@ -211,12 +209,12 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
Arrays.sort(classes);
|
||||
Content classConstantTree = writer.getClassConstantHeader();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (! classDocsWithConstFields.contains(classes[i]) ||
|
||||
! classes[i].isIncluded()) {
|
||||
for (ClassDoc doc : classes) {
|
||||
if (!classDocsWithConstFields.contains(doc) ||
|
||||
!doc.isIncluded()) {
|
||||
continue;
|
||||
}
|
||||
currentClass = classes[i];
|
||||
currentClass = doc;
|
||||
//Build the documentation for the current class.
|
||||
buildChildren(node, classConstantTree);
|
||||
}
|
||||
@ -241,16 +239,13 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
* @return true if the given package has constant fields to document.
|
||||
*/
|
||||
private boolean hasConstantField(PackageDoc pkg) {
|
||||
ClassDoc[] classes;
|
||||
if (pkg.name().length() > 0) {
|
||||
classes = pkg.allClasses();
|
||||
} else {
|
||||
classes = configuration.classDocCatalog.allClasses(
|
||||
DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
}
|
||||
ClassDoc[] classes
|
||||
= (pkg.name().length() > 0)
|
||||
? pkg.allClasses()
|
||||
: configuration.classDocCatalog.allClasses(DocletConstants.DEFAULT_PACKAGE_NAME);
|
||||
boolean found = false;
|
||||
for (int j = 0; j < classes.length; j++){
|
||||
if (classes[j].isIncluded() && hasConstantField(classes[j])) {
|
||||
for (ClassDoc doc : classes) {
|
||||
if (doc.isIncluded() && hasConstantField(doc)) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
@ -267,8 +262,8 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
VisibleMemberMap visibleMemberMapFields = new VisibleMemberMap(classDoc,
|
||||
VisibleMemberMap.FIELDS, configuration);
|
||||
List<?> fields = visibleMemberMapFields.getLeafClassMembers(configuration);
|
||||
for (Iterator<?> iter = fields.iterator(); iter.hasNext(); ) {
|
||||
FieldDoc field = (FieldDoc) iter.next();
|
||||
for (Object f : fields) {
|
||||
FieldDoc field = (FieldDoc) f;
|
||||
if (field.constantValueExpression() != null) {
|
||||
classDocsWithConstFields.add(classDoc);
|
||||
return true;
|
||||
@ -285,8 +280,8 @@ public class ConstantsSummaryBuilder extends AbstractBuilder {
|
||||
*/
|
||||
private boolean hasPrintedPackageIndex(String pkgname) {
|
||||
String[] list = printedPackageHeaders.toArray(new String[] {});
|
||||
for (int i = 0; i < list.length; i++) {
|
||||
if (pkgname.startsWith(list[i])) {
|
||||
for (String packageHeader : list) {
|
||||
if (pkgname.startsWith(packageHeader)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,9 +96,8 @@ public class ConstructorBuilder extends AbstractMemberBuilder {
|
||||
configuration);
|
||||
constructors =
|
||||
new ArrayList<ProgramElementDoc>(visibleMemberMap.getMembersFor(classDoc));
|
||||
for (int i = 0; i < constructors.size(); i++) {
|
||||
if (constructors.get(i).isProtected()
|
||||
|| constructors.get(i).isPrivate()) {
|
||||
for (ProgramElementDoc constructor : constructors) {
|
||||
if (constructor.isProtected() || constructor.isPrivate()) {
|
||||
writer.setFoundNonPubConstructor(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -475,11 +475,9 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||
*/
|
||||
private void buildInheritedSummary(MemberSummaryWriter writer,
|
||||
VisibleMemberMap visibleMemberMap, LinkedList<Content> summaryTreeList) {
|
||||
for (Iterator<ClassDoc> iter = visibleMemberMap.getVisibleClassesList().iterator();
|
||||
iter.hasNext();) {
|
||||
ClassDoc inhclass = iter.next();
|
||||
if (! (inhclass.isPublic() ||
|
||||
Util.isLinkable(inhclass, configuration))) {
|
||||
for (ClassDoc inhclass : visibleMemberMap.getVisibleClassesList()) {
|
||||
if (!(inhclass.isPublic() ||
|
||||
Util.isLinkable(inhclass, configuration))) {
|
||||
continue;
|
||||
}
|
||||
if (inhclass == classDoc) {
|
||||
@ -493,7 +491,7 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||
for (int j = 0; j < inhmembers.size(); ++j) {
|
||||
writer.addInheritedMemberSummary(
|
||||
inhclass.isPackagePrivate() &&
|
||||
! Util.isLinkable(inhclass, configuration) ?
|
||||
!Util.isLinkable(inhclass, configuration) ?
|
||||
classDoc : inhclass,
|
||||
inhmembers.get(j),
|
||||
j == 0,
|
||||
@ -523,8 +521,8 @@ public class MemberSummaryBuilder extends AbstractMemberBuilder {
|
||||
if (!summaryTreeList.isEmpty()) {
|
||||
Content memberTree = writer.getMemberSummaryHeader(
|
||||
classDoc, memberSummaryTree);
|
||||
for (int i = 0; i < summaryTreeList.size(); i++) {
|
||||
memberTree.addContent(summaryTreeList.get(i));
|
||||
for (Content aSummaryTreeList : summaryTreeList) {
|
||||
memberTree.addContent(aSummaryTreeList);
|
||||
}
|
||||
memberSummaryTree.addContent(writer.getMemberTree(memberTree));
|
||||
}
|
||||
|
||||
@ -166,8 +166,8 @@ public class ProfileSummaryBuilder extends AbstractBuilder {
|
||||
*/
|
||||
public void buildPackageSummary(XMLNode node, Content summaryContentTree) {
|
||||
PackageDoc[] packages = configuration.profilePackages.get(profile.name);
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
this.pkg = packages[i];
|
||||
for (PackageDoc aPackage : packages) {
|
||||
this.pkg = aPackage;
|
||||
Content packageSummaryContentTree = profileWriter.getPackageSummaryHeader(this.pkg);
|
||||
buildChildren(node, packageSummaryContentTree);
|
||||
summaryContentTree.addContent(profileWriter.getPackageSummaryTree(
|
||||
|
||||
@ -162,9 +162,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
*/
|
||||
public void buildSerializedFormSummaries(XMLNode node, Content serializedTree) {
|
||||
Content serializedSummariesTree = writer.getSerializedSummariesHeader();
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
currentPackage = packages[i];
|
||||
for (PackageDoc pkg : configuration.packages) {
|
||||
currentPackage = pkg;
|
||||
buildChildren(node, serializedSummariesTree);
|
||||
}
|
||||
serializedTree.addContent(writer.getSerializedContent(
|
||||
@ -215,12 +214,12 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
Content classSerializedTree = writer.getClassSerializedHeader();
|
||||
ClassDoc[] classes = currentPackage.allClasses(false);
|
||||
Arrays.sort(classes);
|
||||
for (int j = 0; j < classes.length; j++) {
|
||||
currentClass = classes[j];
|
||||
for (ClassDoc classDoc : classes) {
|
||||
currentClass = classDoc;
|
||||
fieldWriter = writer.getSerialFieldWriter(currentClass);
|
||||
methodWriter = writer.getSerialMethodWriter(currentClass);
|
||||
if(currentClass.isClass() && currentClass.isSerializable()) {
|
||||
if(!serialClassInclude(currentClass)) {
|
||||
if (currentClass.isClass() && currentClass.isSerializable()) {
|
||||
if (!serialClassInclude(currentClass)) {
|
||||
continue;
|
||||
}
|
||||
Content classTree = writer.getClassHeader(currentClass);
|
||||
@ -239,12 +238,11 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
*/
|
||||
public void buildSerialUIDInfo(XMLNode node, Content classTree) {
|
||||
Content serialUidTree = writer.getSerialUIDInfoHeader();
|
||||
FieldDoc[] fields = currentClass.fields(false);
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].name().equals("serialVersionUID") &&
|
||||
fields[i].constantValueExpression() != null) {
|
||||
for (FieldDoc field : currentClass.fields(false)) {
|
||||
if (field.name().equals("serialVersionUID") &&
|
||||
field.constantValueExpression() != null) {
|
||||
writer.addSerialUIDInfo(SERIAL_VERSION_UID_HEADER,
|
||||
fields[i].constantValueExpression(), serialUidTree);
|
||||
field.constantValueExpression(), serialUidTree);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -569,9 +567,9 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
Tag[] serial = doc.tags("serial");
|
||||
if (serial.length > 0) {
|
||||
String serialtext = StringUtils.toLowerCase(serial[0].text());
|
||||
if (serialtext.indexOf("exclude") >= 0) {
|
||||
if (serialtext.contains("exclude")) {
|
||||
return false;
|
||||
} else if (serialtext.indexOf("include") >= 0) {
|
||||
} else if (serialtext.contains("include")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -585,8 +583,8 @@ public class SerializedFormBuilder extends AbstractBuilder {
|
||||
* @return true if any of the given classes have a @serialinclude tag.
|
||||
*/
|
||||
private boolean serialClassFoundToDocument(ClassDoc[] classes) {
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (serialClassInclude(classes[i])) {
|
||||
for (ClassDoc aClass : classes) {
|
||||
if (serialClassInclude(aClass)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -106,13 +106,13 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
Map<String, String> rankMap = getRankMap(input.isTypeVariableParamTag ?
|
||||
(Object[]) ((MethodDoc)input.element).typeParameters() :
|
||||
(Object[]) ((MethodDoc)input.element).parameters());
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
if (rankMap.containsKey(tags[i].parameterName()) &&
|
||||
rankMap.get(tags[i].parameterName()).equals((input.tagId))) {
|
||||
for (ParamTag tag : tags) {
|
||||
if (rankMap.containsKey(tag.parameterName()) &&
|
||||
rankMap.get(tag.parameterName()).equals((input.tagId))) {
|
||||
output.holder = input.element;
|
||||
output.holderTag = tags[i];
|
||||
output.holderTag = tag;
|
||||
output.inlineTags = input.isFirstSentence ?
|
||||
tags[i].firstSentenceTags() : tags[i].inlineTags();
|
||||
tag.firstSentenceTags() : tag.inlineTags();
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -269,27 +269,26 @@ public class ParamTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
Set<String> alreadyDocumented) {
|
||||
Content result = writer.getOutputInstance();
|
||||
if (paramTags.length > 0) {
|
||||
for (int i = 0; i < paramTags.length; ++i) {
|
||||
ParamTag pt = paramTags[i];
|
||||
for (ParamTag pt : paramTags) {
|
||||
String paramName = isNonTypeParams ?
|
||||
pt.parameterName() : "<" + pt.parameterName() + ">";
|
||||
if (! rankMap.containsKey(pt.parameterName())) {
|
||||
pt.parameterName() : "<" + pt.parameterName() + ">";
|
||||
if (!rankMap.containsKey(pt.parameterName())) {
|
||||
writer.getMsgRetriever().warning(pt.position(),
|
||||
isNonTypeParams ?
|
||||
"doclet.Parameters_warn" :
|
||||
"doclet.Type_Parameters_warn",
|
||||
paramName);
|
||||
isNonTypeParams ?
|
||||
"doclet.Parameters_warn" :
|
||||
"doclet.Type_Parameters_warn",
|
||||
paramName);
|
||||
}
|
||||
String rank = rankMap.get(pt.parameterName());
|
||||
if (rank != null && alreadyDocumented.contains(rank)) {
|
||||
writer.getMsgRetriever().warning(pt.position(),
|
||||
isNonTypeParams ?
|
||||
"doclet.Parameters_dup_warn" :
|
||||
"doclet.Type_Parameters_dup_warn",
|
||||
paramName);
|
||||
isNonTypeParams ?
|
||||
"doclet.Parameters_dup_warn" :
|
||||
"doclet.Type_Parameters_dup_warn",
|
||||
paramName);
|
||||
}
|
||||
result.addContent(processParamTag(isNonTypeParams, writer, pt,
|
||||
pt.parameterName(), alreadyDocumented.size() == 0));
|
||||
pt.parameterName(), alreadyDocumented.size() == 0));
|
||||
alreadyDocumented.add(rank);
|
||||
}
|
||||
}
|
||||
|
||||
@ -112,7 +112,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
this.tagName = tagName;
|
||||
this.header = header;
|
||||
locations = StringUtils.toLowerCase(locations);
|
||||
if (locations.indexOf(ALL) != -1 && locations.indexOf(EXCLUDED) == -1) {
|
||||
if (locations.contains(ALL) && !locations.contains(EXCLUDED)) {
|
||||
this.locations = PACKAGE + TYPE + FIELD + METHOD + CONSTRUCTOR + OVERVIEW;
|
||||
} else {
|
||||
this.locations = locations;
|
||||
@ -134,7 +134,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inConstructor() {
|
||||
return locations.indexOf(CONSTRUCTOR) != -1 && locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(CONSTRUCTOR) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -145,7 +145,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inField() {
|
||||
return locations.indexOf(FIELD) != -1 && locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(FIELD) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -156,7 +156,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inMethod() {
|
||||
return locations.indexOf(METHOD) != -1 && locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(METHOD) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -167,7 +167,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inOverview() {
|
||||
return locations.indexOf(OVERVIEW) != -1 && locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(OVERVIEW) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -178,7 +178,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inPackage() {
|
||||
return locations.indexOf(PACKAGE) != -1 && locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(PACKAGE) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -189,7 +189,7 @@ public class SimpleTaglet extends BaseTaglet implements InheritableTaglet {
|
||||
* otherwise.
|
||||
*/
|
||||
public boolean inType() {
|
||||
return locations.indexOf(TYPE) != -1&& locations.indexOf(EXCLUDED) == -1;
|
||||
return locations.contains(TYPE) && !locations.contains(EXCLUDED);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -370,37 +370,37 @@ public class TagletManager {
|
||||
return;
|
||||
}
|
||||
Taglet taglet;
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
String name = tags[i].name();
|
||||
for (Tag tag : tags) {
|
||||
String name = tag.name();
|
||||
if (name.length() > 0 && name.charAt(0) == '@') {
|
||||
name = name.substring(1, name.length());
|
||||
}
|
||||
if (! (standardTags.contains(name) || customTags.containsKey(name))) {
|
||||
if (standardTagsLowercase.contains(StringUtils.toLowerCase(name))) {
|
||||
message.warning(tags[i].position(), "doclet.UnknownTagLowercase", tags[i].name());
|
||||
message.warning(tag.position(), "doclet.UnknownTagLowercase", tag.name());
|
||||
continue;
|
||||
} else {
|
||||
message.warning(tags[i].position(), "doclet.UnknownTag", tags[i].name());
|
||||
message.warning(tag.position(), "doclet.UnknownTag", tag.name());
|
||||
continue;
|
||||
}
|
||||
}
|
||||
//Check if this tag is being used in the wrong location.
|
||||
if ((taglet = customTags.get(name)) != null) {
|
||||
if (areInlineTags && ! taglet.isInlineTag()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "inline");
|
||||
printTagMisuseWarn(taglet, tag, "inline");
|
||||
}
|
||||
if ((doc instanceof RootDoc) && ! taglet.inOverview()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "overview");
|
||||
printTagMisuseWarn(taglet, tag, "overview");
|
||||
} else if ((doc instanceof PackageDoc) && ! taglet.inPackage()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "package");
|
||||
printTagMisuseWarn(taglet, tag, "package");
|
||||
} else if ((doc instanceof ClassDoc) && ! taglet.inType()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "class");
|
||||
printTagMisuseWarn(taglet, tag, "class");
|
||||
} else if ((doc instanceof ConstructorDoc) && ! taglet.inConstructor()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "constructor");
|
||||
printTagMisuseWarn(taglet, tag, "constructor");
|
||||
} else if ((doc instanceof FieldDoc) && ! taglet.inField()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "field");
|
||||
printTagMisuseWarn(taglet, tag, "field");
|
||||
} else if ((doc instanceof MethodDoc) && ! taglet.inMethod()) {
|
||||
printTagMisuseWarn(taglet, tags[i], "method");
|
||||
printTagMisuseWarn(taglet, tag, "method");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -707,9 +707,8 @@ public class TagletManager {
|
||||
* Initialize lowercase version of standard Javadoc tags.
|
||||
*/
|
||||
private void initStandardTagsLowercase() {
|
||||
Iterator<String> it = standardTags.iterator();
|
||||
while (it.hasNext()) {
|
||||
standardTagsLowercase.add(StringUtils.toLowerCase(it.next()));
|
||||
for (String standardTag : standardTags) {
|
||||
standardTagsLowercase.add(StringUtils.toLowerCase(standardTag));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -204,30 +204,30 @@ public abstract class TagletWriter {
|
||||
tagletManager.checkTags(doc, doc.tags(), false);
|
||||
tagletManager.checkTags(doc, doc.inlineTags(), true);
|
||||
Content currentOutput = null;
|
||||
for (int i = 0; i < taglets.length; i++) {
|
||||
for (Taglet taglet : taglets) {
|
||||
currentOutput = null;
|
||||
if (doc instanceof ClassDoc && taglets[i] instanceof ParamTaglet) {
|
||||
if (doc instanceof ClassDoc && taglet instanceof ParamTaglet) {
|
||||
//The type parameters are documented in a special section away
|
||||
//from the tag info, so skip here.
|
||||
continue;
|
||||
}
|
||||
if (taglets[i] instanceof DeprecatedTaglet) {
|
||||
if (taglet instanceof DeprecatedTaglet) {
|
||||
//Deprecated information is documented "inline", not in tag info
|
||||
//section.
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
currentOutput = taglets[i].getTagletOutput(doc, writer);
|
||||
currentOutput = taglet.getTagletOutput(doc, writer);
|
||||
} catch (IllegalArgumentException e) {
|
||||
//The taglet does not take a member as an argument. Let's try
|
||||
//a single tag.
|
||||
Tag[] tags = doc.tags(taglets[i].getName());
|
||||
Tag[] tags = doc.tags(taglet.getName());
|
||||
if (tags.length > 0) {
|
||||
currentOutput = taglets[i].getTagletOutput(tags[0], writer);
|
||||
currentOutput = taglet.getTagletOutput(tags[0], writer);
|
||||
}
|
||||
}
|
||||
if (currentOutput != null) {
|
||||
tagletManager.seenCustomTag(taglets[i].getName());
|
||||
tagletManager.seenCustomTag(taglet.getName());
|
||||
output.addContent(currentOutput);
|
||||
}
|
||||
}
|
||||
@ -246,15 +246,15 @@ public abstract class TagletWriter {
|
||||
Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
|
||||
Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
|
||||
//This is a custom inline tag.
|
||||
for (int j = 0; j < definedTags.length; j++) {
|
||||
if (("@"+definedTags[j].getName()).equals(inlineTag.name())) {
|
||||
for (Taglet definedTag : definedTags) {
|
||||
if (("@" + definedTag.getName()).equals(inlineTag.name())) {
|
||||
//Given a name of a seen custom tag, remove it from the
|
||||
// set of unseen custom tags.
|
||||
tagletManager.seenCustomTag(definedTags[j].getName());
|
||||
Content output = definedTags[j].getTagletOutput(
|
||||
holderTag != null &&
|
||||
definedTags[j].getName().equals("inheritDoc") ?
|
||||
holderTag : inlineTag, tagletWriter);
|
||||
tagletManager.seenCustomTag(definedTag.getName());
|
||||
Content output = definedTag.getTagletOutput(
|
||||
holderTag != null &&
|
||||
definedTag.getName().equals("inheritDoc") ?
|
||||
holderTag : inlineTag, tagletWriter);
|
||||
return output;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,19 +64,18 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
exception = input.element.containingClass().findClass(input.tagId);
|
||||
}
|
||||
|
||||
ThrowsTag[] tags = ((MethodDoc)input.element).throwsTags();
|
||||
for (int i = 0; i < tags.length; i++) {
|
||||
if (input.tagId.equals(tags[i].exceptionName()) ||
|
||||
(tags[i].exception() != null &&
|
||||
(input.tagId.equals(tags[i].exception().qualifiedName())))) {
|
||||
for (ThrowsTag tag : ((MethodDoc)input.element).throwsTags()) {
|
||||
if (input.tagId.equals(tag.exceptionName()) ||
|
||||
(tag.exception() != null &&
|
||||
(input.tagId.equals(tag.exception().qualifiedName())))) {
|
||||
output.holder = input.element;
|
||||
output.holderTag = tags[i];
|
||||
output.holderTag = tag;
|
||||
output.inlineTags = input.isFirstSentence ?
|
||||
tags[i].firstSentenceTags() : tags[i].inlineTags();
|
||||
output.tagList.add(tags[i]);
|
||||
} else if (exception != null && tags[i].exception() != null &&
|
||||
tags[i].exception().subclassOf(exception)) {
|
||||
output.tagList.add(tags[i]);
|
||||
tag.firstSentenceTags() : tag.inlineTags();
|
||||
output.tagList.add(tag);
|
||||
} else if (exception != null && tag.exception() != null &&
|
||||
tag.exception().subclassOf(exception)) {
|
||||
output.tagList.add(tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -89,17 +88,17 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
TagletWriter writer) {
|
||||
Content result = writer.getOutputInstance();
|
||||
//Add links to the exceptions declared but not documented.
|
||||
for (int i = 0; i < declaredExceptionTypes.length; i++) {
|
||||
if (declaredExceptionTypes[i].asClassDoc() != null &&
|
||||
! alreadyDocumented.contains(
|
||||
declaredExceptionTypes[i].asClassDoc().name()) &&
|
||||
! alreadyDocumented.contains(
|
||||
declaredExceptionTypes[i].asClassDoc().qualifiedName())) {
|
||||
for (Type declaredExceptionType : declaredExceptionTypes) {
|
||||
if (declaredExceptionType.asClassDoc() != null &&
|
||||
!alreadyDocumented.contains(
|
||||
declaredExceptionType.asClassDoc().name()) &&
|
||||
!alreadyDocumented.contains(
|
||||
declaredExceptionType.asClassDoc().qualifiedName())) {
|
||||
if (alreadyDocumented.size() == 0) {
|
||||
result.addContent(writer.getThrowsHeader());
|
||||
}
|
||||
result.addContent(writer.throwsTagOutput(declaredExceptionTypes[i]));
|
||||
alreadyDocumented.add(declaredExceptionTypes[i].asClassDoc().name());
|
||||
result.addContent(writer.throwsTagOutput(declaredExceptionType));
|
||||
alreadyDocumented.add(declaredExceptionType.asClassDoc().name());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@ -115,14 +114,14 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
Content result = writer.getOutputInstance();
|
||||
if (holder instanceof MethodDoc) {
|
||||
Set<Tag> declaredExceptionTags = new LinkedHashSet<Tag>();
|
||||
for (int j = 0; j < declaredExceptionTypes.length; j++) {
|
||||
for (Type declaredExceptionType : declaredExceptionTypes) {
|
||||
DocFinder.Output inheritedDoc =
|
||||
DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
|
||||
declaredExceptionTypes[j].typeName()));
|
||||
DocFinder.search(new DocFinder.Input((MethodDoc) holder, this,
|
||||
declaredExceptionType.typeName()));
|
||||
if (inheritedDoc.tagList.size() == 0) {
|
||||
inheritedDoc = DocFinder.search(new DocFinder.Input(
|
||||
(MethodDoc) holder, this,
|
||||
declaredExceptionTypes[j].qualifiedTypeName()));
|
||||
(MethodDoc) holder, this,
|
||||
declaredExceptionType.qualifiedTypeName()));
|
||||
}
|
||||
declaredExceptionTags.addAll(inheritedDoc.tagList);
|
||||
}
|
||||
@ -167,11 +166,10 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
TagletWriter writer, Set<String> alreadyDocumented, boolean allowDups) {
|
||||
Content result = writer.getOutputInstance();
|
||||
if (throwTags.length > 0) {
|
||||
for (int i = 0; i < throwTags.length; ++i) {
|
||||
ThrowsTag tt = throwTags[i];
|
||||
for (ThrowsTag tt : throwTags) {
|
||||
ClassDoc cd = tt.exception();
|
||||
if ((!allowDups) && (alreadyDocumented.contains(tt.exceptionName()) ||
|
||||
(cd != null && alreadyDocumented.contains(cd.qualifiedName())))) {
|
||||
(cd != null && alreadyDocumented.contains(cd.qualifiedName())))) {
|
||||
continue;
|
||||
}
|
||||
if (alreadyDocumented.size() == 0) {
|
||||
@ -179,7 +177,7 @@ public class ThrowsTaglet extends BaseExecutableMemberTaglet
|
||||
}
|
||||
result.addContent(writer.throwsTagOutput(tt));
|
||||
alreadyDocumented.add(cd != null ?
|
||||
cd.qualifiedName() : tt.exceptionName());
|
||||
cd.qualifiedName() : tt.exceptionName());
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@ -150,10 +150,9 @@ public class ValueTaglet extends BaseInlineTaglet {
|
||||
if (cd == null) {
|
||||
return null;
|
||||
}
|
||||
FieldDoc[] fields = cd.fields();
|
||||
for (int i = 0; i < fields.length; i++) {
|
||||
if (fields[i].name().equals(memberName)) {
|
||||
return fields[i];
|
||||
for (FieldDoc field : cd.fields()) {
|
||||
if (field.name().equals(memberName)) {
|
||||
return field;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -100,8 +100,8 @@ import com.sun.tools.doclets.internal.toolkit.Configuration;
|
||||
public ClassDocCatalog (ClassDoc[] classdocs, Configuration config) {
|
||||
init();
|
||||
this.configuration = config;
|
||||
for (int i = 0; i < classdocs.length; i++) {
|
||||
addClassDoc(classdocs[i]);
|
||||
for (ClassDoc classdoc : classdocs) {
|
||||
addClassDoc(classdoc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -123,43 +123,43 @@ public class ClassTree {
|
||||
* @param configuration the current configuration of the doclet.
|
||||
*/
|
||||
private void buildTree(ClassDoc[] classes, Configuration configuration) {
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
for (ClassDoc aClass : classes) {
|
||||
// In the tree page (e.g overview-tree.html) do not include
|
||||
// information of classes which are deprecated or are a part of a
|
||||
// deprecated package.
|
||||
if (configuration.nodeprecated &&
|
||||
(Util.isDeprecated(classes[i]) ||
|
||||
Util.isDeprecated(classes[i].containingPackage()))) {
|
||||
(Util.isDeprecated(aClass) ||
|
||||
Util.isDeprecated(aClass.containingPackage()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (configuration.javafx
|
||||
&& classes[i].tags("treatAsPrivate").length > 0) {
|
||||
&& aClass.tags("treatAsPrivate").length > 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (classes[i].isEnum()) {
|
||||
processType(classes[i], configuration, baseEnums, subEnums);
|
||||
} else if (classes[i].isClass()) {
|
||||
processType(classes[i], configuration, baseclasses, subclasses);
|
||||
} else if (classes[i].isInterface()) {
|
||||
processInterface(classes[i]);
|
||||
List<ClassDoc> list = implementingclasses.get(classes[i]);
|
||||
if (aClass.isEnum()) {
|
||||
processType(aClass, configuration, baseEnums, subEnums);
|
||||
} else if (aClass.isClass()) {
|
||||
processType(aClass, configuration, baseclasses, subclasses);
|
||||
} else if (aClass.isInterface()) {
|
||||
processInterface(aClass);
|
||||
List<ClassDoc> list = implementingclasses.get(aClass);
|
||||
if (list != null) {
|
||||
Collections.sort(list);
|
||||
}
|
||||
} else if (classes[i].isAnnotationType()) {
|
||||
processType(classes[i], configuration, baseAnnotationTypes,
|
||||
} else if (aClass.isAnnotationType()) {
|
||||
processType(aClass, configuration, baseAnnotationTypes,
|
||||
subAnnotationTypes);
|
||||
}
|
||||
}
|
||||
|
||||
Collections.sort(baseinterfaces);
|
||||
for (Iterator<List<ClassDoc>> it = subinterfaces.values().iterator(); it.hasNext(); ) {
|
||||
Collections.sort(it.next());
|
||||
for (List<ClassDoc> docs : subinterfaces.values()) {
|
||||
Collections.sort(docs);
|
||||
}
|
||||
for (Iterator<List<ClassDoc>> it = subclasses.values().iterator(); it.hasNext(); ) {
|
||||
Collections.sort(it.next());
|
||||
for (List<ClassDoc> docs : subclasses.values()) {
|
||||
Collections.sort(docs);
|
||||
}
|
||||
}
|
||||
|
||||
@ -190,8 +190,8 @@ public class ClassTree {
|
||||
}
|
||||
}
|
||||
List<Type> intfacs = Util.getAllInterfaces(cd, configuration);
|
||||
for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext();) {
|
||||
add(implementingclasses, iter.next().asClassDoc(), cd);
|
||||
for (Type intfac : intfacs) {
|
||||
add(implementingclasses, intfac.asClassDoc(), cd);
|
||||
}
|
||||
}
|
||||
|
||||
@ -206,11 +206,11 @@ public class ClassTree {
|
||||
private void processInterface(ClassDoc cd) {
|
||||
ClassDoc[] intfacs = cd.interfaces();
|
||||
if (intfacs.length > 0) {
|
||||
for (int i = 0; i < intfacs.length; i++) {
|
||||
if (!add(subinterfaces, intfacs[i], cd)) {
|
||||
for (ClassDoc intfac : intfacs) {
|
||||
if (!add(subinterfaces, intfac, cd)) {
|
||||
return;
|
||||
} else {
|
||||
processInterface(intfacs[i]); // Recurse
|
||||
processInterface(intfac); // Recurse
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -341,8 +341,7 @@ public class ClassTree {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
cd = list.get(i);
|
||||
List<ClassDoc> tlist = subs(cd, isEnum);
|
||||
for (int j = 0; j < tlist.size(); j++) {
|
||||
ClassDoc tcd = tlist.get(j);
|
||||
for (ClassDoc tcd : tlist) {
|
||||
if (!list.contains(tcd)) {
|
||||
list.add(tcd);
|
||||
}
|
||||
|
||||
@ -186,44 +186,42 @@ public class ClassUseMapper {
|
||||
this.classtree = classtree;
|
||||
|
||||
// Map subclassing, subinterfacing implementing, ...
|
||||
for (Iterator<ClassDoc> it = classtree.baseclasses().iterator(); it.hasNext();) {
|
||||
subclasses(it.next());
|
||||
for (ClassDoc doc : classtree.baseclasses()) {
|
||||
subclasses(doc);
|
||||
}
|
||||
for (Iterator<ClassDoc> it = classtree.baseinterfaces().iterator(); it.hasNext();) {
|
||||
for (ClassDoc doc : classtree.baseinterfaces()) {
|
||||
// does subinterfacing as side-effect
|
||||
implementingClasses(it.next());
|
||||
implementingClasses(doc);
|
||||
}
|
||||
// Map methods, fields, constructors using a class.
|
||||
ClassDoc[] classes = root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
PackageDoc pkg = classes[i].containingPackage();
|
||||
for (ClassDoc aClass : classes) {
|
||||
PackageDoc pkg = aClass.containingPackage();
|
||||
mapAnnotations(classToPackageAnnotations, pkg, pkg);
|
||||
ClassDoc cd = classes[i];
|
||||
ClassDoc cd = aClass;
|
||||
mapTypeParameters(classToClassTypeParam, cd, cd);
|
||||
mapAnnotations(classToClassAnnotations, cd, cd);
|
||||
FieldDoc[] fields = cd.fields();
|
||||
for (int j = 0; j < fields.length; j++) {
|
||||
FieldDoc fd = fields[j];
|
||||
for (FieldDoc fd : fields) {
|
||||
mapTypeParameters(classToFieldDocTypeParam, fd, fd);
|
||||
mapAnnotations(annotationToFieldDoc, fd, fd);
|
||||
if (! fd.type().isPrimitive()) {
|
||||
if (!fd.type().isPrimitive()) {
|
||||
add(classToField, fd.type().asClassDoc(), fd);
|
||||
}
|
||||
}
|
||||
ConstructorDoc[] cons = cd.constructors();
|
||||
for (int j = 0; j < cons.length; j++) {
|
||||
mapAnnotations(classToConstructorAnnotations, cons[j], cons[j]);
|
||||
mapExecutable(cons[j]);
|
||||
for (ConstructorDoc con : cons) {
|
||||
mapAnnotations(classToConstructorAnnotations, con, con);
|
||||
mapExecutable(con);
|
||||
}
|
||||
MethodDoc[] meths = cd.methods();
|
||||
for (int j = 0; j < meths.length; j++) {
|
||||
MethodDoc md = meths[j];
|
||||
for (MethodDoc md : meths) {
|
||||
mapExecutable(md);
|
||||
mapTypeParameters(classToExecMemberDocTypeParam, md, md);
|
||||
mapAnnotations(classToExecMemberDocAnnotations, md, md);
|
||||
if (! (md.returnType().isPrimitive() || md.returnType() instanceof TypeVariable)) {
|
||||
if (!(md.returnType().isPrimitive() || md.returnType() instanceof TypeVariable)) {
|
||||
mapTypeParameters(classToExecMemberDocReturnTypeParam,
|
||||
md.returnType(), md);
|
||||
md.returnType(), md);
|
||||
add(classToMethodReturn, md.returnType().asClassDoc(), md);
|
||||
}
|
||||
}
|
||||
@ -240,8 +238,8 @@ public class ClassUseMapper {
|
||||
List<ClassDoc> subs = classtree.subclasses(cd);
|
||||
if (subs != null) {
|
||||
ret.addAll(subs);
|
||||
for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
|
||||
ret.addAll(subclasses(it.next()));
|
||||
for (ClassDoc sub : subs) {
|
||||
ret.addAll(subclasses(sub));
|
||||
}
|
||||
}
|
||||
addAll(classToSubclass, cd, ret);
|
||||
@ -259,8 +257,8 @@ public class ClassUseMapper {
|
||||
List<ClassDoc> subs = classtree.subinterfaces(cd);
|
||||
if (subs != null) {
|
||||
ret.addAll(subs);
|
||||
for (Iterator<ClassDoc> it = subs.iterator(); it.hasNext();) {
|
||||
ret.addAll(subinterfaces(it.next()));
|
||||
for (ClassDoc sub : subs) {
|
||||
ret.addAll(subinterfaces(sub));
|
||||
}
|
||||
}
|
||||
addAll(classToSubinterface, cd, ret);
|
||||
@ -281,12 +279,12 @@ public class ClassUseMapper {
|
||||
List<ClassDoc> impl = classtree.implementingclasses(cd);
|
||||
if (impl != null) {
|
||||
ret.addAll(impl);
|
||||
for (Iterator<ClassDoc> it = impl.iterator(); it.hasNext();) {
|
||||
ret.addAll(subclasses(it.next()));
|
||||
for (ClassDoc anImpl : impl) {
|
||||
ret.addAll(subclasses(anImpl));
|
||||
}
|
||||
}
|
||||
for (Iterator<ClassDoc> it = subinterfaces(cd).iterator(); it.hasNext();) {
|
||||
ret.addAll(implementingClasses(it.next()));
|
||||
for (ClassDoc doc : subinterfaces(cd)) {
|
||||
ret.addAll(implementingClasses(doc));
|
||||
}
|
||||
addAll(classToImplementingClass, cd, ret);
|
||||
}
|
||||
@ -298,32 +296,30 @@ public class ClassUseMapper {
|
||||
* inverse mapped.
|
||||
*/
|
||||
private void mapExecutable(ExecutableMemberDoc em) {
|
||||
Parameter[] params = em.parameters();
|
||||
boolean isConstructor = em.isConstructor();
|
||||
List<Type> classArgs = new ArrayList<Type>();
|
||||
for (int k = 0; k < params.length; k++) {
|
||||
Type pcd = params[k].type();
|
||||
for (Parameter param : em.parameters()) {
|
||||
Type pcd = param.type();
|
||||
// primitives don't get mapped, also avoid dups
|
||||
if ((! params[k].type().isPrimitive()) &&
|
||||
! classArgs.contains(pcd) &&
|
||||
! (pcd instanceof TypeVariable)) {
|
||||
add(isConstructor? classToConstructorArgs :classToMethodArgs,
|
||||
pcd.asClassDoc(), em);
|
||||
if ((!param.type().isPrimitive()) &&
|
||||
!classArgs.contains(pcd) &&
|
||||
!(pcd instanceof TypeVariable)) {
|
||||
add(isConstructor ? classToConstructorArgs : classToMethodArgs,
|
||||
pcd.asClassDoc(), em);
|
||||
classArgs.add(pcd);
|
||||
mapTypeParameters(isConstructor?
|
||||
classToConstructorDocArgTypeParam : classToExecMemberDocArgTypeParam,
|
||||
pcd, em);
|
||||
mapTypeParameters(isConstructor ?
|
||||
classToConstructorDocArgTypeParam : classToExecMemberDocArgTypeParam,
|
||||
pcd, em);
|
||||
}
|
||||
mapAnnotations(
|
||||
isConstructor ?
|
||||
isConstructor ?
|
||||
classToConstructorParamAnnotation :
|
||||
classToExecMemberDocParamAnnotation,
|
||||
params[k], em);
|
||||
param, em);
|
||||
}
|
||||
ClassDoc[] thr = em.thrownExceptions();
|
||||
for (int k = 0; k < thr.length; k++) {
|
||||
add(isConstructor? classToConstructorThrows : classToMethodThrows,
|
||||
thr[k], em);
|
||||
for (ClassDoc anException : em.thrownExceptions()) {
|
||||
add(isConstructor ? classToConstructorThrows : classToMethodThrows,
|
||||
anException, em);
|
||||
}
|
||||
}
|
||||
|
||||
@ -378,8 +374,7 @@ public class ClassUseMapper {
|
||||
Set<PackageDoc> pkgSet = packageSet(cd);
|
||||
Set<ClassDoc> clsSet = classSet(cd);
|
||||
// add ref's package to package map and class map
|
||||
for (Iterator<ClassDoc> it = refs.iterator(); it.hasNext();) {
|
||||
ClassDoc cls = it.next();
|
||||
for (ClassDoc cls : refs) {
|
||||
pkgSet.add(cls.containingPackage());
|
||||
clsSet.add(cls);
|
||||
|
||||
@ -400,19 +395,16 @@ public class ClassUseMapper {
|
||||
if (doc instanceof ClassDoc) {
|
||||
typeVariables = ((ClassDoc) doc).typeParameters();
|
||||
} else if (doc instanceof WildcardType) {
|
||||
Type[] extendsBounds = ((WildcardType) doc).extendsBounds();
|
||||
for (int k = 0; k < extendsBounds.length; k++) {
|
||||
addTypeParameterToMap(map, extendsBounds[k], holder);
|
||||
for (Type extendsBound : ((WildcardType) doc).extendsBounds()) {
|
||||
addTypeParameterToMap(map, extendsBound, holder);
|
||||
}
|
||||
Type[] superBounds = ((WildcardType) doc).superBounds();
|
||||
for (int k = 0; k < superBounds.length; k++) {
|
||||
addTypeParameterToMap(map, superBounds[k], holder);
|
||||
for (Type superBound : ((WildcardType) doc).superBounds()) {
|
||||
addTypeParameterToMap(map, superBound, holder);
|
||||
}
|
||||
return;
|
||||
} else if (doc instanceof ParameterizedType) {
|
||||
Type[] typeArguments = ((ParameterizedType) doc).typeArguments();
|
||||
for (int k = 0; k < typeArguments.length; k++) {
|
||||
addTypeParameterToMap(map, typeArguments[k], holder);
|
||||
for (Type typeArgument : ((ParameterizedType) doc).typeArguments()) {
|
||||
addTypeParameterToMap(map, typeArgument, holder);
|
||||
}
|
||||
return;
|
||||
} else if (doc instanceof ExecutableMemberDoc) {
|
||||
@ -424,10 +416,9 @@ public class ClassUseMapper {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < typeVariables.length; i++) {
|
||||
Type[] bounds = typeVariables[i].bounds();
|
||||
for (int j = 0; j < bounds.length; j++) {
|
||||
addTypeParameterToMap(map, bounds[j], holder);
|
||||
for (TypeVariable typeVariable : typeVariables) {
|
||||
for (Type bound : typeVariable.bounds()) {
|
||||
addTypeParameterToMap(map, bound, holder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -454,8 +445,8 @@ public class ClassUseMapper {
|
||||
} else {
|
||||
throw new DocletAbortException("should not happen");
|
||||
}
|
||||
for (int i = 0; i < annotations.length; i++) {
|
||||
AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
|
||||
for (AnnotationDesc annotation : annotations) {
|
||||
AnnotationTypeDoc annotationDoc = annotation.annotationType();
|
||||
if (isPackage)
|
||||
refList(map, annotationDoc).add(holder);
|
||||
else
|
||||
@ -474,10 +465,8 @@ public class ClassUseMapper {
|
||||
*/
|
||||
private <T extends PackageDoc> void mapAnnotations(Map<String,List<T>> map, PackageDoc doc,
|
||||
T holder) {
|
||||
AnnotationDesc[] annotations;
|
||||
annotations = doc.annotations();
|
||||
for (int i = 0; i < annotations.length; i++) {
|
||||
AnnotationTypeDoc annotationDoc = annotations[i].annotationType();
|
||||
for (AnnotationDesc annotation : doc.annotations()) {
|
||||
AnnotationTypeDoc annotationDoc = annotation.annotationType();
|
||||
refList(map, annotationDoc).add(holder);
|
||||
}
|
||||
}
|
||||
|
||||
@ -85,16 +85,12 @@ public class DeprecatedAPIListBuilder {
|
||||
*/
|
||||
private void buildDeprecatedAPIInfo(Configuration configuration) {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
PackageDoc pkg;
|
||||
for (int c = 0; c < packages.length; c++) {
|
||||
pkg = packages[c];
|
||||
for (PackageDoc pkg : packages) {
|
||||
if (Util.isDeprecated(pkg)) {
|
||||
getList(PACKAGE).add(pkg);
|
||||
}
|
||||
}
|
||||
ClassDoc[] classes = configuration.root.classes();
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
ClassDoc cd = classes[i];
|
||||
for (ClassDoc cd : configuration.root.classes()) {
|
||||
if (Util.isDeprecated(cd)) {
|
||||
if (cd.isOrdinaryClass()) {
|
||||
getList(CLASS).add(cd);
|
||||
@ -118,7 +114,7 @@ public class DeprecatedAPIListBuilder {
|
||||
}
|
||||
if (cd.isAnnotationType()) {
|
||||
composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER),
|
||||
((AnnotationTypeDoc) cd).elements());
|
||||
((AnnotationTypeDoc) cd).elements());
|
||||
}
|
||||
}
|
||||
sortDeprecatedLists();
|
||||
@ -131,9 +127,9 @@ public class DeprecatedAPIListBuilder {
|
||||
* @param members members to be added in the list.
|
||||
*/
|
||||
private void composeDeprecatedList(List<Doc> list, MemberDoc[] members) {
|
||||
for (int i = 0; i < members.length; i++) {
|
||||
if (Util.isDeprecated(members[i])) {
|
||||
list.add(members[i]);
|
||||
for (MemberDoc member : members) {
|
||||
if (Util.isDeprecated(member)) {
|
||||
list.add(member);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,19 +132,15 @@ public abstract class DocFile {
|
||||
* Copy the contents of another file directly to this file.
|
||||
*/
|
||||
public void copyFile(DocFile fromFile) throws IOException {
|
||||
InputStream input = fromFile.openInputStream();
|
||||
OutputStream output = openOutputStream();
|
||||
try {
|
||||
try (OutputStream output = openOutputStream();
|
||||
InputStream input = fromFile.openInputStream()) {
|
||||
byte[] bytearr = new byte[1024];
|
||||
int len;
|
||||
while ((len = input.read(bytearr)) != -1) {
|
||||
output.write(bytearr, 0, len);
|
||||
}
|
||||
} catch (FileNotFoundException exc) {
|
||||
} catch (SecurityException exc) {
|
||||
} finally {
|
||||
input.close();
|
||||
output.close();
|
||||
}
|
||||
catch (FileNotFoundException | SecurityException exc) {
|
||||
}
|
||||
}
|
||||
|
||||
@ -165,35 +161,26 @@ public abstract class DocFile {
|
||||
if (in == null)
|
||||
return;
|
||||
|
||||
OutputStream out = openOutputStream();
|
||||
try {
|
||||
try (OutputStream out = openOutputStream()) {
|
||||
if (!replaceNewLine) {
|
||||
byte[] buf = new byte[2048];
|
||||
int n;
|
||||
while((n = in.read(buf))>0) out.write(buf,0,n);
|
||||
while ((n = in.read(buf)) > 0)
|
||||
out.write(buf, 0, n);
|
||||
} else {
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
BufferedWriter writer;
|
||||
if (configuration.docencoding == null) {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(out));
|
||||
} else {
|
||||
writer = new BufferedWriter(new OutputStreamWriter(out,
|
||||
configuration.docencoding));
|
||||
}
|
||||
try {
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(in));
|
||||
BufferedWriter writer = new BufferedWriter(configuration.docencoding == null
|
||||
? new OutputStreamWriter(out)
|
||||
: new OutputStreamWriter(out, configuration.docencoding))) {
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
writer.write(line);
|
||||
writer.write(DocletConstants.NL);
|
||||
}
|
||||
} finally {
|
||||
reader.close();
|
||||
writer.close();
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
out.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace(System.err);
|
||||
|
||||
@ -220,8 +220,8 @@ public class DocFinder {
|
||||
// appropriate element here.
|
||||
MethodDoc[] implementedMethods =
|
||||
(new ImplementedMethods((MethodDoc) input.element, null)).build(false);
|
||||
for (int i = 0; i < implementedMethods.length; i++) {
|
||||
inheritedSearchInput.element = implementedMethods[i];
|
||||
for (MethodDoc implementedMethod : implementedMethods) {
|
||||
inheritedSearchInput.element = implementedMethod;
|
||||
output = search(inheritedSearchInput);
|
||||
output.isValidInheritDocTag = true;
|
||||
if (output.inlineTags.length > 0) {
|
||||
|
||||
@ -234,11 +234,10 @@ public class Extern {
|
||||
try {
|
||||
URL link = pkglisturlpath.toURI().resolve(DocPaths.PACKAGE_LIST.getPath()).toURL();
|
||||
readPackageList(link.openStream(), urlpath, false);
|
||||
} catch (URISyntaxException exc) {
|
||||
} catch (URISyntaxException | MalformedURLException exc) {
|
||||
throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
|
||||
} catch (MalformedURLException exc) {
|
||||
throw new Fault(configuration.getText("doclet.MalformedURL", pkglisturlpath.toString()), exc);
|
||||
} catch (IOException exc) {
|
||||
}
|
||||
catch (IOException exc) {
|
||||
throw new Fault(configuration.getText("doclet.URL_error", pkglisturlpath.toString()), exc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -185,8 +185,7 @@ public class Group {
|
||||
if (!groupList.contains(defaultGroupName)) {
|
||||
groupList.add(defaultGroupName);
|
||||
}
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
PackageDoc pkg = packages[i];
|
||||
for (PackageDoc pkg : packages) {
|
||||
String pkgName = pkg.name();
|
||||
String groupName = pkgNameGroupMap.get(pkgName);
|
||||
// if this package is not explicitly assigned to a group,
|
||||
@ -212,8 +211,7 @@ public class Group {
|
||||
* expression list.
|
||||
*/
|
||||
String regExpGroupName(String pkgName) {
|
||||
for (int j = 0; j < sortedRegExpList.size(); j++) {
|
||||
String regexp = sortedRegExpList.get(j);
|
||||
for (String regexp : sortedRegExpList) {
|
||||
if (pkgName.startsWith(regexp)) {
|
||||
return regExpGroupMap.get(regexp);
|
||||
}
|
||||
|
||||
@ -89,8 +89,7 @@ public class ImplementedMethods {
|
||||
*/
|
||||
private void buildImplementedMethodList(boolean sort) {
|
||||
List<Type> intfacs = Util.getAllInterfaces(classdoc, configuration, sort);
|
||||
for (Iterator<Type> iter = intfacs.iterator(); iter.hasNext(); ) {
|
||||
Type interfaceType = iter.next();
|
||||
for (Type interfaceType : intfacs) {
|
||||
MethodDoc found = Util.findMethod(interfaceType.asClassDoc(), method);
|
||||
if (found != null) {
|
||||
removeOverriddenMethod(found);
|
||||
@ -132,8 +131,7 @@ public class ImplementedMethods {
|
||||
*/
|
||||
private boolean overridingMethodFound(MethodDoc method) {
|
||||
ClassDoc containingClass = method.containingClass();
|
||||
for (int i = 0; i < methlist.size(); i++) {
|
||||
MethodDoc listmethod = methlist.get(i);
|
||||
for (MethodDoc listmethod : methlist) {
|
||||
if (containingClass == listmethod.containingClass()) {
|
||||
// it's the same method.
|
||||
return true;
|
||||
|
||||
@ -132,8 +132,8 @@ public class IndexBuilder {
|
||||
* sort each element which is a list.
|
||||
*/
|
||||
protected void sortIndexMap() {
|
||||
for (Iterator<List<Doc>> it = indexmap.values().iterator(); it.hasNext(); ) {
|
||||
Collections.sort(it.next(), new DocComparator());
|
||||
for (List<Doc> docs : indexmap.values()) {
|
||||
Collections.sort(docs, new DocComparator());
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,9 +150,8 @@ public class IndexBuilder {
|
||||
if (!classesOnly) {
|
||||
if (packages.length == 0) {
|
||||
Set<PackageDoc> set = new HashSet<PackageDoc>();
|
||||
PackageDoc pd;
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
pd = classes[i].containingPackage();
|
||||
for (ClassDoc aClass : classes) {
|
||||
PackageDoc pd = aClass.containingPackage();
|
||||
if (pd != null && pd.name().length() > 0) {
|
||||
set.add(pd);
|
||||
}
|
||||
@ -164,9 +163,9 @@ public class IndexBuilder {
|
||||
}
|
||||
adjustIndexMap(classes);
|
||||
if (!classesOnly) {
|
||||
for (int i = 0; i < classes.length; i++) {
|
||||
if (shouldAddToIndexMap(classes[i])) {
|
||||
putMembersInIndexMap(classes[i]);
|
||||
for (ClassDoc aClass : classes) {
|
||||
if (shouldAddToIndexMap(aClass)) {
|
||||
putMembersInIndexMap(aClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -194,19 +193,19 @@ public class IndexBuilder {
|
||||
* @param elements Array of members.
|
||||
*/
|
||||
protected void adjustIndexMap(Doc[] elements) {
|
||||
for (int i = 0; i < elements.length; i++) {
|
||||
if (shouldAddToIndexMap(elements[i])) {
|
||||
String name = elements[i].name();
|
||||
char ch = (name.length()==0)?
|
||||
'*' :
|
||||
Character.toUpperCase(name.charAt(0));
|
||||
Character unicode = new Character(ch);
|
||||
for (Doc element : elements) {
|
||||
if (shouldAddToIndexMap(element)) {
|
||||
String name = element.name();
|
||||
char ch = (name.length() == 0) ?
|
||||
'*' :
|
||||
Character.toUpperCase(name.charAt(0));
|
||||
Character unicode = ch;
|
||||
List<Doc> list = indexmap.get(unicode);
|
||||
if (list == null) {
|
||||
list = new ArrayList<Doc>();
|
||||
indexmap.put(unicode, list);
|
||||
}
|
||||
list.add(elements[i]);
|
||||
list.add(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,10 +147,9 @@ public class MetaKeywords {
|
||||
protected ArrayList<String> getMemberKeywords(MemberDoc[] memberdocs) {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
String membername;
|
||||
for (int i=0; i < memberdocs.length; i++) {
|
||||
membername = memberdocs[i].name()
|
||||
+ (memberdocs[i].isMethod() ? "()" : "");
|
||||
if ( ! results.contains(membername) ) {
|
||||
for (MemberDoc memberdoc : memberdocs) {
|
||||
membername = memberdoc.name() + (memberdoc.isMethod() ? "()" : "");
|
||||
if (!results.contains(membername)) {
|
||||
results.add(membername);
|
||||
}
|
||||
}
|
||||
|
||||
@ -62,9 +62,9 @@ public abstract class MethodFinder {
|
||||
|
||||
public MethodDoc searchInterfaces(ClassDoc cd, MethodDoc method) {
|
||||
MethodDoc[] implementedMethods = (new ImplementedMethods(method, null)).build();
|
||||
for (int i = 0; i < implementedMethods.length; i++) {
|
||||
if (isCorrectMethod(implementedMethods[i])) {
|
||||
return implementedMethods[i];
|
||||
for (MethodDoc implementedMethod : implementedMethods) {
|
||||
if (isCorrectMethod(implementedMethod)) {
|
||||
return implementedMethod;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
@ -76,17 +76,16 @@ public class PackageListWriter extends PrintWriter {
|
||||
}
|
||||
|
||||
protected void generatePackageListFile(RootDoc root) {
|
||||
PackageDoc[] packages = configuration.packages;
|
||||
ArrayList<String> names = new ArrayList<String>();
|
||||
for (int i = 0; i < packages.length; i++) {
|
||||
for (PackageDoc pkg : configuration.packages) {
|
||||
// if the -nodeprecated option is set and the package is marked as
|
||||
// deprecated, do not include it in the packages list.
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(packages[i])))
|
||||
names.add(packages[i].name());
|
||||
if (!(configuration.nodeprecated && Util.isDeprecated(pkg)))
|
||||
names.add(pkg.name());
|
||||
}
|
||||
Collections.sort(names);
|
||||
for (int i = 0; i < names.size(); i++) {
|
||||
println(names.get(i));
|
||||
for (String name : names) {
|
||||
println(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,7 +26,9 @@
|
||||
package com.sun.tools.doclets.internal.toolkit.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Target;
|
||||
import java.util.*;
|
||||
import javax.tools.StandardLocation;
|
||||
|
||||
@ -75,9 +77,9 @@ public class Util {
|
||||
public static List<ProgramElementDoc> excludeDeprecatedMembersAsList(
|
||||
ProgramElementDoc[] members) {
|
||||
List<ProgramElementDoc> list = new ArrayList<ProgramElementDoc>();
|
||||
for (int i = 0; i < members.length; i++) {
|
||||
if (members[i].tags("deprecated").length == 0) {
|
||||
list.add(members[i]);
|
||||
for (ProgramElementDoc member : members) {
|
||||
if (member.tags("deprecated").length == 0) {
|
||||
list.add(member);
|
||||
}
|
||||
}
|
||||
Collections.sort(list);
|
||||
@ -102,8 +104,8 @@ public class Util {
|
||||
* @return boolean True if non-public member found, false otherwise.
|
||||
*/
|
||||
public static boolean nonPublicMemberFound(ProgramElementDoc[] members) {
|
||||
for (int i = 0; i < members.length; i++) {
|
||||
if (!members[i].isPublic()) {
|
||||
for (ProgramElementDoc member : members) {
|
||||
if (!member.isPublic()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -119,9 +121,9 @@ public class Util {
|
||||
*/
|
||||
public static MethodDoc findMethod(ClassDoc cd, MethodDoc method) {
|
||||
MethodDoc[] methods = cd.methods();
|
||||
for (int i = 0; i < methods.length; i++) {
|
||||
if (executableMembersEqual(method, methods[i])) {
|
||||
return methods[i];
|
||||
for (MethodDoc m : methods) {
|
||||
if (executableMembersEqual(method, m)) {
|
||||
return m;
|
||||
|
||||
}
|
||||
}
|
||||
@ -241,9 +243,7 @@ public class Util {
|
||||
|
||||
first = false;
|
||||
}
|
||||
} catch (SecurityException exc) {
|
||||
throw new DocletAbortException(exc);
|
||||
} catch (IOException exc) {
|
||||
} catch (SecurityException | IOException exc) {
|
||||
throw new DocletAbortException(exc);
|
||||
}
|
||||
}
|
||||
@ -287,18 +287,15 @@ public class Util {
|
||||
superType = type.asClassDoc().superclassType();
|
||||
}
|
||||
|
||||
for (int i = 0; i < interfaceTypes.length; i++) {
|
||||
Type interfaceType = interfaceTypes[i];
|
||||
for (Type interfaceType : interfaceTypes) {
|
||||
ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
|
||||
if (! (interfaceClassDoc.isPublic() ||
|
||||
(configuration == null ||
|
||||
isLinkable(interfaceClassDoc, configuration)))) {
|
||||
if (!(interfaceClassDoc.isPublic() ||
|
||||
(configuration == null ||
|
||||
isLinkable(interfaceClassDoc, configuration)))) {
|
||||
continue;
|
||||
}
|
||||
results.put(interfaceClassDoc, interfaceType);
|
||||
List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration, sort);
|
||||
for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
|
||||
Type t = iter.next();
|
||||
for (Type t : getAllInterfaces(interfaceType, configuration, sort)) {
|
||||
results.put(t.asClassDoc(), t);
|
||||
}
|
||||
}
|
||||
@ -351,20 +348,18 @@ public class Util {
|
||||
private static void addAllInterfaceTypes(Map<ClassDoc,Type> results, Type type,
|
||||
Type[] interfaceTypes, boolean raw,
|
||||
Configuration configuration) {
|
||||
for (int i = 0; i < interfaceTypes.length; i++) {
|
||||
Type interfaceType = interfaceTypes[i];
|
||||
for (Type interfaceType : interfaceTypes) {
|
||||
ClassDoc interfaceClassDoc = interfaceType.asClassDoc();
|
||||
if (! (interfaceClassDoc.isPublic() ||
|
||||
(configuration != null &&
|
||||
isLinkable(interfaceClassDoc, configuration)))) {
|
||||
if (!(interfaceClassDoc.isPublic() ||
|
||||
(configuration != null &&
|
||||
isLinkable(interfaceClassDoc, configuration)))) {
|
||||
continue;
|
||||
}
|
||||
if (raw)
|
||||
interfaceType = interfaceType.asClassDoc();
|
||||
results.put(interfaceClassDoc, interfaceType);
|
||||
List<Type> superInterfaces = getAllInterfaces(interfaceType, configuration);
|
||||
for (Iterator<Type> iter = superInterfaces.iterator(); iter.hasNext(); ) {
|
||||
Type superInterface = iter.next();
|
||||
for (Type superInterface : superInterfaces) {
|
||||
results.put(superInterface.asClassDoc(), superInterface);
|
||||
}
|
||||
}
|
||||
@ -429,10 +424,9 @@ public class Util {
|
||||
* @return true return true if it should be documented and false otherwise.
|
||||
*/
|
||||
public static boolean isDocumentedAnnotation(AnnotationTypeDoc annotationDoc) {
|
||||
AnnotationDesc[] annotationDescList = annotationDoc.annotations();
|
||||
for (int i = 0; i < annotationDescList.length; i++) {
|
||||
if (annotationDescList[i].annotationType().qualifiedName().equals(
|
||||
java.lang.annotation.Documented.class.getName())){
|
||||
for (AnnotationDesc anno : annotationDoc.annotations()) {
|
||||
if (anno.annotationType().qualifiedName().equals(
|
||||
Documented.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -448,13 +442,12 @@ public class Util {
|
||||
|| !(elems[0].value().value() instanceof AnnotationValue[]))
|
||||
return true; // error recovery
|
||||
|
||||
AnnotationValue[] values = (AnnotationValue[])elems[0].value().value();
|
||||
for (int i = 0; i < values.length; i++) {
|
||||
Object value = values[i].value();
|
||||
for (AnnotationValue aValue : (AnnotationValue[])elems[0].value().value()) {
|
||||
Object value = aValue.value();
|
||||
if (!(value instanceof FieldDoc))
|
||||
return true; // error recovery
|
||||
|
||||
FieldDoc eValue = (FieldDoc)value;
|
||||
FieldDoc eValue = (FieldDoc) value;
|
||||
if (Util.isJava5DeclarationElementType(eValue)) {
|
||||
return true;
|
||||
}
|
||||
@ -480,10 +473,10 @@ public class Util {
|
||||
// Annotations with no target are treated as declaration as well
|
||||
if (annotationDescList.length==0)
|
||||
return true;
|
||||
for (int i = 0; i < annotationDescList.length; i++) {
|
||||
if (annotationDescList[i].annotationType().qualifiedName().equals(
|
||||
java.lang.annotation.Target.class.getName())) {
|
||||
if (isDeclarationTarget(annotationDescList[i]))
|
||||
for (AnnotationDesc anno : annotationDescList) {
|
||||
if (anno.annotationType().qualifiedName().equals(
|
||||
Target.class.getName())) {
|
||||
if (isDeclarationTarget(anno))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -602,7 +595,7 @@ public class Util {
|
||||
* @return the text with all tabs expanded
|
||||
*/
|
||||
public static String replaceTabs(Configuration configuration, String text) {
|
||||
if (text.indexOf("\t") == -1)
|
||||
if (!text.contains("\t"))
|
||||
return text;
|
||||
|
||||
final int tabLength = configuration.sourcetab;
|
||||
@ -664,32 +657,30 @@ public class Util {
|
||||
*/
|
||||
public static void setEnumDocumentation(Configuration configuration,
|
||||
ClassDoc classDoc) {
|
||||
MethodDoc[] methods = classDoc.methods();
|
||||
for (int j = 0; j < methods.length; j++) {
|
||||
MethodDoc currentMethod = methods[j];
|
||||
for (MethodDoc currentMethod : classDoc.methods()) {
|
||||
if (currentMethod.name().equals("values") &&
|
||||
currentMethod.parameters().length == 0) {
|
||||
currentMethod.parameters().length == 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(configuration.getText("doclet.enum_values_doc.main", classDoc.name()));
|
||||
sb.append("\n@return ");
|
||||
sb.append(configuration.getText("doclet.enum_values_doc.return"));
|
||||
currentMethod.setRawCommentText(sb.toString());
|
||||
} else if (currentMethod.name().equals("valueOf") &&
|
||||
currentMethod.parameters().length == 1) {
|
||||
currentMethod.parameters().length == 1) {
|
||||
Type paramType = currentMethod.parameters()[0].type();
|
||||
if (paramType != null &&
|
||||
paramType.qualifiedTypeName().equals(String.class.getName())) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
|
||||
sb.append("\n@param name ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
|
||||
sb.append("\n@return ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
|
||||
sb.append("\n@throws IllegalArgumentException ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
|
||||
sb.append("\n@throws NullPointerException ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
|
||||
currentMethod.setRawCommentText(sb.toString());
|
||||
paramType.qualifiedTypeName().equals(String.class.getName())) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.main", classDoc.name()));
|
||||
sb.append("\n@param name ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.param_name"));
|
||||
sb.append("\n@return ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.return"));
|
||||
sb.append("\n@throws IllegalArgumentException ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_ila"));
|
||||
sb.append("\n@throws NullPointerException ");
|
||||
sb.append(configuration.getText("doclet.enum_valueof_doc.throws_npe"));
|
||||
currentMethod.setRawCommentText(sb.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -710,9 +701,9 @@ public class Util {
|
||||
annotationDescList = ((PackageDoc)doc).annotations();
|
||||
else
|
||||
annotationDescList = ((ProgramElementDoc)doc).annotations();
|
||||
for (int i = 0; i < annotationDescList.length; i++) {
|
||||
if (annotationDescList[i].annotationType().qualifiedName().equals(
|
||||
java.lang.Deprecated.class.getName())){
|
||||
for (AnnotationDesc anno : annotationDescList) {
|
||||
if (anno.annotationType().qualifiedName().equals(
|
||||
Deprecated.class.getName())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -173,8 +173,7 @@ public class VisibleMemberMap {
|
||||
*/
|
||||
private List<ProgramElementDoc> getInheritedPackagePrivateMethods(Configuration configuration) {
|
||||
List<ProgramElementDoc> results = new ArrayList<ProgramElementDoc>();
|
||||
for (Iterator<ClassDoc> iter = visibleClasses.iterator(); iter.hasNext(); ) {
|
||||
ClassDoc currentClass = iter.next();
|
||||
for (ClassDoc currentClass : visibleClasses) {
|
||||
if (currentClass != classdoc &&
|
||||
currentClass.isPackagePrivate() &&
|
||||
!Util.isLinkable(currentClass, configuration)) {
|
||||
@ -221,11 +220,11 @@ public class VisibleMemberMap {
|
||||
private void sort(List<ClassDoc> list) {
|
||||
List<ClassDoc> classes = new ArrayList<ClassDoc>();
|
||||
List<ClassDoc> interfaces = new ArrayList<ClassDoc>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ClassDoc cd = list.get(i);
|
||||
for (ClassDoc cd : list) {
|
||||
if (cd.isClass()) {
|
||||
classes.add(cd);
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
interfaces.add(cd);
|
||||
}
|
||||
}
|
||||
@ -235,23 +234,23 @@ public class VisibleMemberMap {
|
||||
}
|
||||
|
||||
private void fillMemberLevelMap(List<ProgramElementDoc> list, String level) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object key = getMemberKey(list.get(i));
|
||||
Map<ProgramElementDoc,String> memberLevelMap = memberNameMap.get(key);
|
||||
for (ProgramElementDoc element : list) {
|
||||
Object key = getMemberKey(element);
|
||||
Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
|
||||
if (memberLevelMap == null) {
|
||||
memberLevelMap = new HashMap<ProgramElementDoc,String>();
|
||||
memberLevelMap = new HashMap<ProgramElementDoc, String>();
|
||||
memberNameMap.put(key, memberLevelMap);
|
||||
}
|
||||
memberLevelMap.put(list.get(i), level);
|
||||
memberLevelMap.put(element, level);
|
||||
}
|
||||
}
|
||||
|
||||
private void purgeMemberLevelMap(List<ProgramElementDoc> list, String level) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
Object key = getMemberKey(list.get(i));
|
||||
for (ProgramElementDoc element : list) {
|
||||
Object key = getMemberKey(element);
|
||||
Map<ProgramElementDoc, String> memberLevelMap = memberNameMap.get(key);
|
||||
if (level.equals(memberLevelMap.get(list.get(i))))
|
||||
memberLevelMap.remove(list.get(i));
|
||||
if (level.equals(memberLevelMap.get(element)))
|
||||
memberLevelMap.remove(element);
|
||||
}
|
||||
}
|
||||
|
||||
@ -273,11 +272,10 @@ public class VisibleMemberMap {
|
||||
}
|
||||
|
||||
public boolean isEqual(MethodDoc member) {
|
||||
for (Iterator<ProgramElementDoc> iter = members.iterator(); iter.hasNext(); ) {
|
||||
MethodDoc member2 = (MethodDoc) iter.next();
|
||||
if (Util.executableMembersEqual(member, member2)) {
|
||||
for (ProgramElementDoc element : members) {
|
||||
if (Util.executableMembersEqual(member, (MethodDoc) element)) {
|
||||
members.add(member);
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
@ -345,9 +343,9 @@ public class VisibleMemberMap {
|
||||
private void mapClass() {
|
||||
addMembers(mappingClass);
|
||||
ClassDoc[] interfaces = mappingClass.interfaces();
|
||||
for (int i = 0; i < interfaces.length; i++) {
|
||||
for (ClassDoc anInterface : interfaces) {
|
||||
String locallevel = level + 1;
|
||||
ClassMembers cm = new ClassMembers(interfaces[i], locallevel);
|
||||
ClassMembers cm = new ClassMembers(anInterface, locallevel);
|
||||
cm.mapClass();
|
||||
}
|
||||
if (mappingClass.isClass()) {
|
||||
@ -371,13 +369,12 @@ public class VisibleMemberMap {
|
||||
private void addMembers(ClassDoc fromClass) {
|
||||
List<ProgramElementDoc> cdmembers = getClassMembers(fromClass, true);
|
||||
List<ProgramElementDoc> incllist = new ArrayList<ProgramElementDoc>();
|
||||
for (int i = 0; i < cdmembers.size(); i++) {
|
||||
ProgramElementDoc pgmelem = cdmembers.get(i);
|
||||
for (ProgramElementDoc pgmelem : cdmembers) {
|
||||
if (!found(members, pgmelem) &&
|
||||
memberIsVisible(pgmelem) &&
|
||||
!isOverridden(pgmelem, level) &&
|
||||
!isTreatedAsPrivate(pgmelem)) {
|
||||
incllist.add(pgmelem);
|
||||
incllist.add(pgmelem);
|
||||
}
|
||||
}
|
||||
if (incllist.size() > 0) {
|
||||
@ -491,18 +488,17 @@ public class VisibleMemberMap {
|
||||
boolean required) {
|
||||
AnnotationTypeElementDoc[] members = doc.elements();
|
||||
List<AnnotationTypeElementDoc> targetMembers = new ArrayList<AnnotationTypeElementDoc>();
|
||||
for (int i = 0; i < members.length; i++) {
|
||||
if ((required && members[i].defaultValue() == null) ||
|
||||
((!required) && members[i].defaultValue() != null)){
|
||||
targetMembers.add(members[i]);
|
||||
for (AnnotationTypeElementDoc member : members) {
|
||||
if ((required && member.defaultValue() == null) ||
|
||||
((!required) && member.defaultValue() != null)) {
|
||||
targetMembers.add(member);
|
||||
}
|
||||
}
|
||||
return targetMembers.toArray(new AnnotationTypeElementDoc[]{});
|
||||
}
|
||||
|
||||
private boolean found(List<ProgramElementDoc> list, ProgramElementDoc elem) {
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
ProgramElementDoc pgmelem = list.get(i);
|
||||
for (ProgramElementDoc pgmelem : list) {
|
||||
if (Util.matches(pgmelem, elem)) {
|
||||
return true;
|
||||
}
|
||||
@ -520,10 +516,7 @@ public class VisibleMemberMap {
|
||||
Map<?,String> memberLevelMap = (Map<?,String>) memberNameMap.get(getMemberKey(pgmdoc));
|
||||
if (memberLevelMap == null)
|
||||
return false;
|
||||
String mappedlevel = null;
|
||||
Iterator<String> iterator = memberLevelMap.values().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
mappedlevel = iterator.next();
|
||||
for (String mappedlevel : memberLevelMap.values()) {
|
||||
if (mappedlevel.equals(STARTLEVEL) ||
|
||||
(level.startsWith(mappedlevel) &&
|
||||
!level.equals(mappedlevel))) {
|
||||
@ -744,8 +737,7 @@ public class VisibleMemberMap {
|
||||
}
|
||||
|
||||
private ClassMember getClassMember(MethodDoc member) {
|
||||
for (Iterator<?> iter = memberNameMap.keySet().iterator(); iter.hasNext();) {
|
||||
Object key = iter.next();
|
||||
for (Object key : memberNameMap.keySet()) {
|
||||
if (key instanceof String) {
|
||||
continue;
|
||||
} else if (((ClassMember) key).isEqual(member)) {
|
||||
|
||||
@ -257,8 +257,7 @@ public class DocLint implements Plugin {
|
||||
|
||||
public void init(JavacTask task, String[] args, boolean addTaskListener) {
|
||||
env = new Env();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String arg = args[i];
|
||||
for (String arg : args) {
|
||||
if (arg.equals(XMSGS_OPTION)) {
|
||||
env.messages.setOptions(null);
|
||||
} else if (arg.startsWith(XMSGS_CUSTOM_PREFIX)) {
|
||||
|
||||
@ -218,9 +218,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.getClassLoader(location);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -231,9 +229,7 @@ public class ClientCodeWrapper {
|
||||
return wrapJavaFileObjects(clientJavaFileManager.list(location, packageName, kinds, recurse));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -244,9 +240,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.inferBinaryName(location, unwrap(file));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -257,9 +251,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.isSameFile(unwrap(a), unwrap(b));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -270,9 +262,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.handleOption(current, remaining);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -283,9 +273,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.hasLocation(location);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -296,9 +284,7 @@ public class ClientCodeWrapper {
|
||||
return wrap(clientJavaFileManager.getJavaFileForInput(location, className, kind));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -309,9 +295,7 @@ public class ClientCodeWrapper {
|
||||
return wrap(clientJavaFileManager.getJavaFileForOutput(location, className, kind, unwrap(sibling)));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -322,9 +306,7 @@ public class ClientCodeWrapper {
|
||||
return wrap(clientJavaFileManager.getFileForInput(location, packageName, relativeName));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -335,9 +317,7 @@ public class ClientCodeWrapper {
|
||||
return wrap(clientJavaFileManager.getFileForOutput(location, packageName, relativeName, unwrap(sibling)));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -348,9 +328,7 @@ public class ClientCodeWrapper {
|
||||
clientJavaFileManager.flush();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -361,9 +339,7 @@ public class ClientCodeWrapper {
|
||||
clientJavaFileManager.close();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -374,9 +350,7 @@ public class ClientCodeWrapper {
|
||||
return clientJavaFileManager.isSupportedOption(option);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -400,9 +374,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.toUri();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -413,9 +385,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.getName();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -426,9 +396,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.openInputStream();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -439,9 +407,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.openOutputStream();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -452,9 +418,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.openReader(ignoreEncodingErrors);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -465,9 +429,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.getCharContent(ignoreEncodingErrors);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -478,9 +440,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.openWriter();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -491,9 +451,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.getLastModified();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -504,9 +462,7 @@ public class ClientCodeWrapper {
|
||||
return clientFileObject.delete();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -528,9 +484,7 @@ public class ClientCodeWrapper {
|
||||
return ((JavaFileObject)clientFileObject).getKind();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -541,9 +495,7 @@ public class ClientCodeWrapper {
|
||||
return ((JavaFileObject)clientFileObject).isNameCompatible(simpleName, kind);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -554,9 +506,7 @@ public class ClientCodeWrapper {
|
||||
return ((JavaFileObject)clientFileObject).getNestingKind();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -567,9 +517,7 @@ public class ClientCodeWrapper {
|
||||
return ((JavaFileObject)clientFileObject).getAccessLevel();
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -593,9 +541,7 @@ public class ClientCodeWrapper {
|
||||
clientDiagnosticListener.report(unwrap(diagnostic));
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -668,9 +614,7 @@ public class ClientCodeWrapper {
|
||||
clientTaskListener.started(ev);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
@ -681,9 +625,7 @@ public class ClientCodeWrapper {
|
||||
clientTaskListener.finished(ev);
|
||||
} catch (ClientCodeException e) {
|
||||
throw e;
|
||||
} catch (RuntimeException e) {
|
||||
throw new ClientCodeException(e);
|
||||
} catch (Error e) {
|
||||
} catch (RuntimeException | Error e) {
|
||||
throw new ClientCodeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +64,7 @@ public class FSInfo {
|
||||
|
||||
public List<File> getJarClassPath(File file) throws IOException {
|
||||
String parent = file.getParent();
|
||||
JarFile jarFile = new JarFile(file);
|
||||
try {
|
||||
try (JarFile jarFile = new JarFile(file)) {
|
||||
Manifest man = jarFile.getManifest();
|
||||
if (man == null)
|
||||
return Collections.emptyList();
|
||||
@ -80,15 +79,14 @@ public class FSInfo {
|
||||
|
||||
List<File> list = new ArrayList<File>();
|
||||
|
||||
for (StringTokenizer st = new StringTokenizer(path); st.hasMoreTokens(); ) {
|
||||
for (StringTokenizer st = new StringTokenizer(path);
|
||||
st.hasMoreTokens(); ) {
|
||||
String elt = st.nextToken();
|
||||
File f = (parent == null ? new File(elt) : new File(parent, elt));
|
||||
list.add(f);
|
||||
}
|
||||
|
||||
return list;
|
||||
} finally {
|
||||
jarFile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -109,8 +109,7 @@ class RegularFileObject extends BaseFileObject {
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
CharBuffer cb = fileManager.getCachedContent(this);
|
||||
if (cb == null) {
|
||||
InputStream in = new FileInputStream(file);
|
||||
try {
|
||||
try (InputStream in = new FileInputStream(file)) {
|
||||
ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
JavaFileObject prev = fileManager.log.useSource(this);
|
||||
try {
|
||||
@ -122,8 +121,6 @@ class RegularFileObject extends BaseFileObject {
|
||||
if (!ignoreEncodingErrors) {
|
||||
fileManager.cache(this, cb);
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
return cb;
|
||||
|
||||
@ -205,8 +205,7 @@ public class ZipArchive implements Archive {
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
CharBuffer cb = fileManager.getCachedContent(this);
|
||||
if (cb == null) {
|
||||
InputStream in = zarch.zfile.getInputStream(entry);
|
||||
try {
|
||||
try (InputStream in = zarch.zfile.getInputStream(entry)) {
|
||||
ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
JavaFileObject prev = fileManager.log.useSource(this);
|
||||
try {
|
||||
@ -218,8 +217,6 @@ public class ZipArchive implements Archive {
|
||||
if (!ignoreEncodingErrors) {
|
||||
fileManager.cache(this, cb);
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
return cb;
|
||||
|
||||
@ -162,8 +162,7 @@ public class ZipFileIndexArchive implements Archive {
|
||||
public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
CharBuffer cb = fileManager.getCachedContent(this);
|
||||
if (cb == null) {
|
||||
InputStream in = new ByteArrayInputStream(zfIndex.read(entry));
|
||||
try {
|
||||
try (InputStream in = new ByteArrayInputStream(zfIndex.read(entry))) {
|
||||
ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
JavaFileObject prev = fileManager.log.useSource(this);
|
||||
try {
|
||||
@ -174,8 +173,6 @@ public class ZipFileIndexArchive implements Archive {
|
||||
fileManager.recycleByteBuffer(bb); // save for next time
|
||||
if (!ignoreEncodingErrors)
|
||||
fileManager.cache(this, cb);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
return cb;
|
||||
|
||||
@ -113,14 +113,12 @@ public class ZipFileIndexCache {
|
||||
}
|
||||
|
||||
public synchronized void clearCache(long timeNotUsed) {
|
||||
Iterator<File> cachedFileIterator = map.keySet().iterator();
|
||||
while (cachedFileIterator.hasNext()) {
|
||||
File cachedFile = cachedFileIterator.next();
|
||||
for (File cachedFile : map.keySet()) {
|
||||
ZipFileIndex cachedZipIndex = map.get(cachedFile);
|
||||
if (cachedZipIndex != null) {
|
||||
long timeToTest = cachedZipIndex.lastReferenceTimeStamp + timeNotUsed;
|
||||
if (timeToTest < cachedZipIndex.lastReferenceTimeStamp || // Overflow...
|
||||
System.currentTimeMillis() > timeToTest) {
|
||||
System.currentTimeMillis() > timeToTest) {
|
||||
map.remove(cachedFile);
|
||||
}
|
||||
}
|
||||
|
||||
@ -697,7 +697,7 @@ public class JNIWriter {
|
||||
|
||||
// Separates parameters.
|
||||
if (signature != null) {
|
||||
if (signature.indexOf(",") != -1) {
|
||||
if (signature.contains(",")) {
|
||||
st = new StringTokenizer(signature, ",");
|
||||
if (st != null) {
|
||||
while (st.hasMoreTokens()) {
|
||||
@ -755,13 +755,13 @@ public class JNIWriter {
|
||||
|
||||
if(paramsig != null){
|
||||
|
||||
if(paramsig.indexOf("[]") != -1) {
|
||||
if(paramsig.contains("[]")) {
|
||||
// Gets array dimension.
|
||||
int endindex = paramsig.indexOf("[]");
|
||||
componentType = paramsig.substring(0, endindex);
|
||||
String dimensionString = paramsig.substring(endindex);
|
||||
if(dimensionString != null){
|
||||
while(dimensionString.indexOf("[]") != -1){
|
||||
while(dimensionString.contains("[]")){
|
||||
paramJVMSig += "[";
|
||||
int beginindex = dimensionString.indexOf("]") + 1;
|
||||
if(beginindex < dimensionString.length()){
|
||||
@ -785,29 +785,32 @@ public class JNIWriter {
|
||||
String JVMSig = "";
|
||||
|
||||
if(componentType != null){
|
||||
if(componentType.equals("void")) JVMSig += SIG_VOID ;
|
||||
else if(componentType.equals("boolean")) JVMSig += SIG_BOOLEAN ;
|
||||
else if(componentType.equals("byte")) JVMSig += SIG_BYTE ;
|
||||
else if(componentType.equals("char")) JVMSig += SIG_CHAR ;
|
||||
else if(componentType.equals("short")) JVMSig += SIG_SHORT ;
|
||||
else if(componentType.equals("int")) JVMSig += SIG_INT ;
|
||||
else if(componentType.equals("long")) JVMSig += SIG_LONG ;
|
||||
else if(componentType.equals("float")) JVMSig += SIG_FLOAT ;
|
||||
else if(componentType.equals("double")) JVMSig += SIG_DOUBLE ;
|
||||
else {
|
||||
if(!componentType.equals("")){
|
||||
TypeElement classNameDoc = elems.getTypeElement(componentType);
|
||||
switch (componentType) {
|
||||
case "void": JVMSig += SIG_VOID; break;
|
||||
case "boolean": JVMSig += SIG_BOOLEAN; break;
|
||||
case "byte": JVMSig += SIG_BYTE; break;
|
||||
case "char": JVMSig += SIG_CHAR; break;
|
||||
case "short": JVMSig += SIG_SHORT; break;
|
||||
case "int": JVMSig += SIG_INT; break;
|
||||
case "long": JVMSig += SIG_LONG; break;
|
||||
case "float": JVMSig += SIG_FLOAT; break;
|
||||
case "double": JVMSig += SIG_DOUBLE; break;
|
||||
default:
|
||||
if (!componentType.equals("")) {
|
||||
TypeElement classNameDoc = elems.getTypeElement(componentType);
|
||||
|
||||
if(classNameDoc == null){
|
||||
throw new SignatureException(componentType);
|
||||
}else {
|
||||
String classname = classNameDoc.getQualifiedName().toString();
|
||||
String newclassname = classname.replace('.', '/');
|
||||
JVMSig += "L";
|
||||
JVMSig += newclassname;
|
||||
JVMSig += ";";
|
||||
if (classNameDoc == null) {
|
||||
throw new SignatureException(componentType);
|
||||
}
|
||||
else {
|
||||
String classname = classNameDoc.getQualifiedName().toString();
|
||||
String newclassname = classname.replace('.', '/');
|
||||
JVMSig += "L";
|
||||
JVMSig += newclassname;
|
||||
JVMSig += ";";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return JVMSig;
|
||||
|
||||
@ -55,8 +55,7 @@ public class CommandLine {
|
||||
throws IOException
|
||||
{
|
||||
ListBuffer<String> newArgs = new ListBuffer<String>();
|
||||
for (int i = 0; i < args.length; i++) {
|
||||
String arg = args[i];
|
||||
for (String arg : args) {
|
||||
if (arg.length() > 1 && arg.charAt(0) == '@') {
|
||||
arg = arg.substring(1);
|
||||
if (arg.charAt(0) == '@') {
|
||||
@ -74,17 +73,17 @@ public class CommandLine {
|
||||
private static void loadCmdFile(String name, ListBuffer<String> args)
|
||||
throws IOException
|
||||
{
|
||||
Reader r = new BufferedReader(new FileReader(name));
|
||||
StreamTokenizer st = new StreamTokenizer(r);
|
||||
st.resetSyntax();
|
||||
st.wordChars(' ', 255);
|
||||
st.whitespaceChars(0, ' ');
|
||||
st.commentChar('#');
|
||||
st.quoteChar('"');
|
||||
st.quoteChar('\'');
|
||||
while (st.nextToken() != StreamTokenizer.TT_EOF) {
|
||||
args.append(st.sval);
|
||||
try (Reader r = new BufferedReader(new FileReader(name))) {
|
||||
StreamTokenizer st = new StreamTokenizer(r);
|
||||
st.resetSyntax();
|
||||
st.wordChars(' ', 255);
|
||||
st.whitespaceChars(0, ' ');
|
||||
st.commentChar('#');
|
||||
st.quoteChar('"');
|
||||
st.quoteChar('\'');
|
||||
while (st.nextToken() != StreamTokenizer.TT_EOF) {
|
||||
args.append(st.sval);
|
||||
}
|
||||
}
|
||||
r.close();
|
||||
}
|
||||
}
|
||||
|
||||
@ -726,13 +726,10 @@ public class JavaCompiler {
|
||||
log.error(cdef.pos(), "source.cant.overwrite.input.file", outFile);
|
||||
return null;
|
||||
} else {
|
||||
BufferedWriter out = new BufferedWriter(outFile.openWriter());
|
||||
try {
|
||||
try (BufferedWriter out = new BufferedWriter(outFile.openWriter())) {
|
||||
new Pretty(out, true).printUnit(env.toplevel, cdef);
|
||||
if (verbose)
|
||||
log.printVerbose("wrote.file", outFile);
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
return outFile;
|
||||
}
|
||||
|
||||
@ -458,10 +458,8 @@ public class Main {
|
||||
pluginsToCall.add(List.from(plugin.split("\\s+")));
|
||||
}
|
||||
JavacTask task = null;
|
||||
Iterator<Plugin> iter = sl.iterator();
|
||||
while (iter.hasNext()) {
|
||||
Plugin plugin = iter.next();
|
||||
for (List<String> p: pluginsToCall) {
|
||||
for (Plugin plugin : sl) {
|
||||
for (List<String> p : pluginsToCall) {
|
||||
if (plugin.getName().equals(p.head)) {
|
||||
pluginsToCall.remove(p);
|
||||
try {
|
||||
@ -640,14 +638,11 @@ public class Main {
|
||||
final String algorithm = "MD5";
|
||||
byte[] digest;
|
||||
MessageDigest md = MessageDigest.getInstance(algorithm);
|
||||
DigestInputStream in = new DigestInputStream(url.openStream(), md);
|
||||
try {
|
||||
try (DigestInputStream in = new DigestInputStream(url.openStream(), md)) {
|
||||
byte[] buf = new byte[8192];
|
||||
int n;
|
||||
do { n = in.read(buf); } while (n > 0);
|
||||
digest = md.digest();
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b: digest)
|
||||
|
||||
@ -219,8 +219,7 @@ abstract class PathFileObject implements JavaFileObject {
|
||||
public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
|
||||
CharBuffer cb = fileManager.getCachedContent(this);
|
||||
if (cb == null) {
|
||||
InputStream in = openInputStream();
|
||||
try {
|
||||
try (InputStream in = openInputStream()) {
|
||||
ByteBuffer bb = fileManager.makeByteBuffer(in);
|
||||
JavaFileObject prev = fileManager.log.useSource(this);
|
||||
try {
|
||||
@ -232,8 +231,6 @@ abstract class PathFileObject implements JavaFileObject {
|
||||
if (!ignoreEncodingErrors) {
|
||||
fileManager.cache(this, cb);
|
||||
}
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
return cb;
|
||||
|
||||
@ -265,9 +265,7 @@ public class CreateSymbols extends AbstractProcessor {
|
||||
writeClass(pool, nestedClass, writer);
|
||||
}
|
||||
}
|
||||
} catch (ClassWriter.StringOverflow ex) {
|
||||
throw new RuntimeException(ex);
|
||||
} catch (ClassWriter.PoolOverflow ex) {
|
||||
} catch (ClassWriter.StringOverflow | ClassWriter.PoolOverflow ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,30 +69,24 @@ public abstract class Profiles {
|
||||
}
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"));
|
||||
try {
|
||||
for (String type: lists.get(i)) {
|
||||
try (BufferedWriter out = new BufferedWriter(new FileWriter(i + ".txt"))) {
|
||||
for (String type : lists.get(i)) {
|
||||
out.write(type);
|
||||
out.newLine();
|
||||
}
|
||||
} finally {
|
||||
out.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Profiles read(File file) throws IOException {
|
||||
BufferedInputStream in = new BufferedInputStream(new FileInputStream(file));
|
||||
try {
|
||||
try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file))) {
|
||||
Properties p = new Properties();
|
||||
p.load(in);
|
||||
if (p.containsKey("java/lang/Object"))
|
||||
return new SimpleProfiles(p);
|
||||
else
|
||||
return new MakefileProfiles(p);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -137,7 +137,7 @@ public class BasicDiagnosticFormatter extends AbstractDiagnosticFormatter {
|
||||
BasicConfiguration conf = getConfiguration();
|
||||
int indentSource = conf.getIndentation(DiagnosticPart.SOURCE);
|
||||
String sourceLine = "\n" + formatSourceLine(d, indentSource);
|
||||
boolean singleLine = msg.indexOf("\n") == -1;
|
||||
boolean singleLine = !msg.contains("\n");
|
||||
if (singleLine || getConfiguration().getSourcePosition() == SourcePosition.BOTTOM)
|
||||
return msg + sourceLine;
|
||||
else
|
||||
|
||||
@ -63,8 +63,8 @@ public class Convert {
|
||||
char[] cs = s.toCharArray();
|
||||
int limit = Integer.MAX_VALUE / (radix/2);
|
||||
int n = 0;
|
||||
for (int i = 0; i < cs.length; i++) {
|
||||
int d = Character.digit(cs[i], radix);
|
||||
for (char c : cs) {
|
||||
int d = Character.digit(c, radix);
|
||||
if (n < 0 ||
|
||||
n > limit ||
|
||||
n * radix > Integer.MAX_VALUE - d)
|
||||
@ -85,8 +85,8 @@ public class Convert {
|
||||
char[] cs = s.toCharArray();
|
||||
long limit = Long.MAX_VALUE / (radix/2);
|
||||
long n = 0;
|
||||
for (int i = 0; i < cs.length; i++) {
|
||||
int d = Character.digit(cs[i], radix);
|
||||
for (char c : cs) {
|
||||
int d = Character.digit(c, radix);
|
||||
if (n < 0 ||
|
||||
n > limit ||
|
||||
n * radix > Long.MAX_VALUE - d)
|
||||
|
||||
@ -156,8 +156,8 @@ public class ListBuffer<A> extends AbstractQueue<A> {
|
||||
/** Append all elements in an array to buffer.
|
||||
*/
|
||||
public ListBuffer<A> appendArray(A[] xs) {
|
||||
for (int i = 0; i < xs.length; i++) {
|
||||
append(xs[i]);
|
||||
for (A x : xs) {
|
||||
append(x);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -169,7 +169,6 @@ public final class ServiceLoader<S>
|
||||
throws ServiceConfigurationError
|
||||
{
|
||||
InputStream in = null;
|
||||
BufferedReader r = null;
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
try {
|
||||
// The problem is that by default, streams opened with
|
||||
@ -186,14 +185,14 @@ public final class ServiceLoader<S>
|
||||
uc.setUseCaches(false);
|
||||
in = uc.getInputStream();
|
||||
// ... end of workaround.
|
||||
r = new BufferedReader(new InputStreamReader(in, "utf-8"));
|
||||
int lc = 1;
|
||||
while ((lc = parseLine(service, u, r, lc, names)) >= 0);
|
||||
try (BufferedReader r = new BufferedReader(new InputStreamReader(in, "utf-8"))) {
|
||||
int lc = 1;
|
||||
while ((lc = parseLine(service, u, r, lc, names)) >= 0);
|
||||
}
|
||||
} catch (IOException x) {
|
||||
fail(service, "Error reading configuration file", x);
|
||||
} finally {
|
||||
try {
|
||||
if (r != null) r.close();
|
||||
if (in != null) in.close();
|
||||
} catch (IOException y) {
|
||||
fail(service, "Error closing configuration file", y);
|
||||
|
||||
@ -971,9 +971,8 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
||||
}
|
||||
|
||||
// search interfaces
|
||||
ClassDoc intf[] = interfaces();
|
||||
for (int i = 0; i < intf.length; i++) {
|
||||
cdi = (ClassDocImpl)intf[i];
|
||||
for (ClassDoc intf : interfaces()) {
|
||||
cdi = (ClassDocImpl) intf;
|
||||
mdi = cdi.searchMethod(methodName, paramTypes, searched);
|
||||
if (mdi != null) {
|
||||
return mdi;
|
||||
@ -1080,9 +1079,8 @@ public class ClassDocImpl extends ProgramElementDocImpl implements ClassDoc {
|
||||
}
|
||||
|
||||
// search interfaces
|
||||
ClassDoc intf[] = interfaces();
|
||||
for (int i = 0; i < intf.length; i++) {
|
||||
cdi = (ClassDocImpl)intf[i];
|
||||
for (ClassDoc intf : interfaces()) {
|
||||
cdi = (ClassDocImpl) intf;
|
||||
FieldDocImpl fdi = cdi.searchField(fieldName, searched);
|
||||
if (fdi != null) {
|
||||
return fdi;
|
||||
|
||||
@ -151,29 +151,39 @@ class Comment {
|
||||
text = tx;
|
||||
} else {
|
||||
TagImpl tag;
|
||||
if (tagName.equals("@exception") || tagName.equals("@throws")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new ThrowsTagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@param")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new ParamTagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@see")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new SeeTagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@serialField")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new SerialFieldTagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@return")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@author")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
} else if (tagName.equals("@version")) {
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
} else {
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
switch (tagName) {
|
||||
case "@exception":
|
||||
case "@throws":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new ThrowsTagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@param":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new ParamTagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@see":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new SeeTagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@serialField":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new SerialFieldTagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@return":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@author":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
break;
|
||||
case "@version":
|
||||
warnIfEmpty(tagName, tx);
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
break;
|
||||
default:
|
||||
tag = new TagImpl(holder, tagName, tx);
|
||||
break;
|
||||
}
|
||||
tagList.append(tag);
|
||||
}
|
||||
|
||||
@ -159,12 +159,11 @@ class DocLocale {
|
||||
*/
|
||||
private Locale searchLocale(String language, String country,
|
||||
String variant) {
|
||||
Locale[] locales = Locale.getAvailableLocales();
|
||||
for (int i = 0; i < locales.length; i++) {
|
||||
if (locales[i].getLanguage().equals(language) &&
|
||||
(country == null || locales[i].getCountry().equals(country)) &&
|
||||
(variant == null || locales[i].getVariant().equals(variant))) {
|
||||
return locales[i];
|
||||
for (Locale loc : Locale.getAvailableLocales()) {
|
||||
if (loc.getLanguage().equals(language) &&
|
||||
(country == null || loc.getCountry().equals(country)) &&
|
||||
(variant == null || loc.getVariant().equals(variant))) {
|
||||
return loc;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@ -231,11 +230,10 @@ class DocLocale {
|
||||
* return true else return false.
|
||||
*/
|
||||
private boolean htmlSentenceTerminatorFound(String str, int index) {
|
||||
for (int i = 0; i < sentenceTerminators.length; i++) {
|
||||
String terminator = sentenceTerminators[i];
|
||||
for (String terminator : sentenceTerminators) {
|
||||
if (str.regionMatches(true, index, terminator,
|
||||
0, terminator.length())) {
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -210,7 +210,7 @@ public class DocletInvoker {
|
||||
Class<?>[] paramTypes = { String.class };
|
||||
Object[] params = { option };
|
||||
try {
|
||||
retVal = invoke(methodName, new Integer(0), paramTypes, params);
|
||||
retVal = invoke(methodName, 0, paramTypes, params);
|
||||
} catch (DocletInvokeException exc) {
|
||||
return -1;
|
||||
}
|
||||
@ -308,7 +308,7 @@ public class DocletInvoker {
|
||||
if (appClassLoader != null) // will be null if doclet class provided via API
|
||||
Thread.currentThread().setContextClassLoader(appClassLoader);
|
||||
return meth.invoke(null , params);
|
||||
} catch (IllegalArgumentException exc) {
|
||||
} catch (IllegalArgumentException | NullPointerException exc) {
|
||||
messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
|
||||
docletClassName, methodName, exc.toString());
|
||||
throw new DocletInvokeException();
|
||||
@ -316,11 +316,8 @@ public class DocletInvoker {
|
||||
messager.error(Messager.NOPOS, "main.doclet_method_not_accessible",
|
||||
docletClassName, methodName);
|
||||
throw new DocletInvokeException();
|
||||
} catch (NullPointerException exc) {
|
||||
messager.error(Messager.NOPOS, "main.internal_error_exception_thrown",
|
||||
docletClassName, methodName, exc.toString());
|
||||
throw new DocletInvokeException();
|
||||
} catch (InvocationTargetException exc) {
|
||||
}
|
||||
catch (InvocationTargetException exc) {
|
||||
Throwable err = exc.getTargetException();
|
||||
if (apiMode)
|
||||
throw new ClientCodeException(err);
|
||||
|
||||
@ -385,10 +385,9 @@ class SeeTagImpl extends TagImpl implements SeeTag, LayoutCharacters {
|
||||
private MemberDoc findReferencedMethod(String memName, String[] paramarr,
|
||||
ClassDoc referencedClass) {
|
||||
MemberDoc meth = findExecutableMember(memName, paramarr, referencedClass);
|
||||
ClassDoc[] nestedclasses = referencedClass.innerClasses();
|
||||
if (meth == null) {
|
||||
for (int i = 0; i < nestedclasses.length; i++) {
|
||||
meth = findReferencedMethod(memName, paramarr, nestedclasses[i]);
|
||||
for (ClassDoc nestedClass : referencedClass.innerClasses()) {
|
||||
meth = findReferencedMethod(memName, paramarr, nestedClass);
|
||||
if (meth != null) {
|
||||
return meth;
|
||||
}
|
||||
|
||||
@ -234,20 +234,19 @@ class SerializedForm {
|
||||
DocEnv env,
|
||||
ClassSymbol def) {
|
||||
Names names = def.name.table.names;
|
||||
|
||||
SerialFieldTag[] sfTag = spfDoc.serialFieldTags();
|
||||
for (int i = 0; i < sfTag.length; i++) {
|
||||
if (sfTag[i].fieldName() == null || sfTag[i].fieldType() == null) // ignore malformed @serialField tags
|
||||
for (SerialFieldTag tag : spfDoc.serialFieldTags()) {
|
||||
if (tag.fieldName() == null || tag.fieldType() == null) // ignore malformed @serialField tags
|
||||
continue;
|
||||
|
||||
Name fieldName = names.fromString(sfTag[i].fieldName());
|
||||
Name fieldName = names.fromString(tag.fieldName());
|
||||
|
||||
// Look for a FieldDocImpl that is documented by serialFieldTagImpl.
|
||||
for (Scope.Entry e = def.members().lookup(fieldName); e.scope != null; e = e.next()) {
|
||||
for (Scope.Entry e = def.members().lookup(fieldName);
|
||||
e.scope != null; e = e.next()) {
|
||||
if (e.sym.kind == Kinds.VAR) {
|
||||
VarSymbol f = (VarSymbol)e.sym;
|
||||
VarSymbol f = (VarSymbol) e.sym;
|
||||
FieldDocImpl fdi = env.getFieldDoc(f);
|
||||
((SerialFieldTagImpl)(sfTag[i])).mapToFieldDocImpl(fdi);
|
||||
((SerialFieldTagImpl) (tag)).mapToFieldDocImpl(fdi);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -74,10 +74,9 @@ public class JavahTool implements NativeHeaderTool {
|
||||
}
|
||||
|
||||
public int isSupportedOption(String option) {
|
||||
JavahTask.Option[] options = JavahTask.recognizedOptions;
|
||||
for (int i = 0; i < options.length; i++) {
|
||||
if (options[i].matches(option))
|
||||
return (options[i].hasArg ? 1 : 0);
|
||||
for (JavahTask.Option opt : JavahTask.recognizedOptions) {
|
||||
if (opt.matches(option))
|
||||
return (opt.hasArg ? 1 : 0);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -121,7 +121,7 @@ public class TypeSignature {
|
||||
|
||||
// Separates parameters.
|
||||
if (signature != null) {
|
||||
if (signature.indexOf(",") != -1) {
|
||||
if (signature.contains(",")) {
|
||||
st = new StringTokenizer(signature, ",");
|
||||
if (st != null) {
|
||||
while (st.hasMoreTokens()) {
|
||||
@ -179,13 +179,13 @@ public class TypeSignature {
|
||||
|
||||
if(paramsig != null){
|
||||
|
||||
if(paramsig.indexOf("[]") != -1) {
|
||||
if(paramsig.contains("[]")) {
|
||||
// Gets array dimension.
|
||||
int endindex = paramsig.indexOf("[]");
|
||||
componentType = paramsig.substring(0, endindex);
|
||||
String dimensionString = paramsig.substring(endindex);
|
||||
if(dimensionString != null){
|
||||
while(dimensionString.indexOf("[]") != -1){
|
||||
while(dimensionString.contains("[]")){
|
||||
paramJVMSig += "[";
|
||||
int beginindex = dimensionString.indexOf("]") + 1;
|
||||
if(beginindex < dimensionString.length()){
|
||||
@ -209,29 +209,32 @@ public class TypeSignature {
|
||||
String JVMSig = "";
|
||||
|
||||
if(componentType != null){
|
||||
if(componentType.equals("void")) JVMSig += SIG_VOID ;
|
||||
else if(componentType.equals("boolean")) JVMSig += SIG_BOOLEAN ;
|
||||
else if(componentType.equals("byte")) JVMSig += SIG_BYTE ;
|
||||
else if(componentType.equals("char")) JVMSig += SIG_CHAR ;
|
||||
else if(componentType.equals("short")) JVMSig += SIG_SHORT ;
|
||||
else if(componentType.equals("int")) JVMSig += SIG_INT ;
|
||||
else if(componentType.equals("long")) JVMSig += SIG_LONG ;
|
||||
else if(componentType.equals("float")) JVMSig += SIG_FLOAT ;
|
||||
else if(componentType.equals("double")) JVMSig += SIG_DOUBLE ;
|
||||
else {
|
||||
if(!componentType.equals("")){
|
||||
TypeElement classNameDoc = elems.getTypeElement(componentType);
|
||||
switch (componentType) {
|
||||
case "void": JVMSig += SIG_VOID; break;
|
||||
case "boolean": JVMSig += SIG_BOOLEAN; break;
|
||||
case "byte": JVMSig += SIG_BYTE; break;
|
||||
case "char": JVMSig += SIG_CHAR; break;
|
||||
case "short": JVMSig += SIG_SHORT; break;
|
||||
case "int": JVMSig += SIG_INT; break;
|
||||
case "long": JVMSig += SIG_LONG; break;
|
||||
case "float": JVMSig += SIG_FLOAT; break;
|
||||
case "double": JVMSig += SIG_DOUBLE; break;
|
||||
default:
|
||||
if (!componentType.equals("")) {
|
||||
TypeElement classNameDoc = elems.getTypeElement(componentType);
|
||||
|
||||
if(classNameDoc == null){
|
||||
throw new SignatureException(componentType);
|
||||
}else {
|
||||
String classname = classNameDoc.getQualifiedName().toString();
|
||||
String newclassname = classname.replace('.', '/');
|
||||
JVMSig += "L";
|
||||
JVMSig += newclassname;
|
||||
JVMSig += ";";
|
||||
if (classNameDoc == null) {
|
||||
throw new SignatureException(componentType);
|
||||
}
|
||||
else {
|
||||
String classname = classNameDoc.getQualifiedName().toString();
|
||||
String newclassname = classname.replace('.', '/');
|
||||
JVMSig += "L";
|
||||
JVMSig += newclassname;
|
||||
JVMSig += ";";
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return JVMSig;
|
||||
|
||||
@ -219,8 +219,7 @@ public class AnnotationWriter extends BasicWriter {
|
||||
Descriptor d = new Descriptor(index);
|
||||
print(d.getFieldType(constant_pool));
|
||||
return;
|
||||
} catch (ConstantPoolException ignore) {
|
||||
} catch (InvalidDescriptor ignore) {
|
||||
} catch (ConstantPoolException | InvalidDescriptor ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -758,8 +758,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
|
||||
}
|
||||
|
||||
};
|
||||
} catch (URISyntaxException ignore) {
|
||||
} catch (IOException ignore) {
|
||||
} catch (URISyntaxException | IOException ignore) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -82,9 +82,7 @@ public class StackMapWriter extends InstructionDetailWriter {
|
||||
ConstantPool cp = classWriter.getClassFile().constant_pool;
|
||||
String argString = d.getParameterTypes(cp);
|
||||
args = argString.substring(1, argString.length() - 1).split("[, ]+");
|
||||
} catch (ConstantPoolException e) {
|
||||
return;
|
||||
} catch (InvalidDescriptor e) {
|
||||
} catch (ConstantPoolException | InvalidDescriptor e) {
|
||||
return;
|
||||
}
|
||||
boolean isStatic = m.access_flags.is(AccessFlags.ACC_STATIC);
|
||||
|
||||
@ -75,11 +75,14 @@ public class Log {
|
||||
throws ProblemException {
|
||||
out = o;
|
||||
err = e;
|
||||
if (l.equals("warn")) level = WARN;
|
||||
else if (l.equals("info")) level = INFO;
|
||||
else if (l.equals("debug")) level = DEBUG;
|
||||
else if (l.equals("trace")) level = TRACE;
|
||||
else throw new ProblemException("No such log level \""+l+"\"");
|
||||
switch (l) {
|
||||
case "warn": level = WARN; break;
|
||||
case "info": level = INFO; break;
|
||||
case "debug": level = DEBUG; break;
|
||||
case "trace": level = TRACE; break;
|
||||
default:
|
||||
throw new ProblemException("No such log level \"" + l + "\"");
|
||||
}
|
||||
}
|
||||
|
||||
static public boolean isTracing() {
|
||||
|
||||
@ -749,8 +749,9 @@ public class Main {
|
||||
* Look for a specific switch, return true if found.
|
||||
*/
|
||||
public static boolean findBooleanOption(String[] args, String option) {
|
||||
for (int i = 0; i<args.length; ++i) {
|
||||
if (args[i].equals(option)) return true;
|
||||
for (String arg : args) {
|
||||
if (arg.equals(option))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -158,12 +158,14 @@ public enum SourceVersion {
|
||||
try {
|
||||
String specVersion = System.getProperty("java.specification.version");
|
||||
|
||||
if ("1.8".equals(specVersion))
|
||||
return RELEASE_8;
|
||||
else if("1.7".equals(specVersion))
|
||||
return RELEASE_7;
|
||||
else if("1.6".equals(specVersion))
|
||||
return RELEASE_6;
|
||||
switch (specVersion) {
|
||||
case "1.8":
|
||||
return RELEASE_8;
|
||||
case "1.7":
|
||||
return RELEASE_7;
|
||||
case "1.6":
|
||||
return RELEASE_6;
|
||||
}
|
||||
} catch (SecurityException se) {}
|
||||
|
||||
return RELEASE_5;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user