8030253: Update langtools to use strings-in-switch
authorbriangoetz
Wed, 18 Dec 2013 10:29:25 -0500
changeset 22159 682da512ec17
parent 22158 dca1b80ed62c
child 22160 fe9f4b305bcf
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
langtools/src/share/classes/com/sun/tools/classfile/Attributes.java
langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java
langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java
langtools/src/share/classes/com/sun/tools/doclint/DocLint.java
langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java
langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java
langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java
langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java
langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java
langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java
langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java
langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java
langtools/src/share/classes/com/sun/tools/javac/main/Main.java
langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java
langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java
langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java
langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java
langtools/src/share/classes/com/sun/tools/javac/util/Convert.java
langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java
langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java
langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java
langtools/src/share/classes/com/sun/tools/javadoc/Comment.java
langtools/src/share/classes/com/sun/tools/javadoc/DocLocale.java
langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java
langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java
langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java
langtools/src/share/classes/com/sun/tools/javah/JavahTool.java
langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java
langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java
langtools/src/share/classes/com/sun/tools/javap/JavapTask.java
langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java
langtools/src/share/classes/com/sun/tools/sjavac/Log.java
langtools/src/share/classes/com/sun/tools/sjavac/Main.java
langtools/src/share/classes/javax/lang/model/SourceVersion.java
--- a/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/Attributes.java	Wed Dec 18 10:29:25 2013 -0500
@@ -56,8 +56,7 @@
     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) {
--- a/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/classfile/ClassWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -57,11 +57,8 @@
      * 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();
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -268,13 +268,13 @@
 
     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;
                     }
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractIndexWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -101,14 +101,13 @@
         // 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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AbstractTreeWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -87,14 +87,13 @@
         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 @@
         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 @@
                         contentTree.addContent(", ");
                     }
                     addPreQualifiedClassLink(LinkInfoImpl.Kind.TREE,
-                            interfaces[i], contentTree);
+                                             intf, contentTree);
                     counter++;
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AllClassesFrameWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -150,9 +150,9 @@
      * @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 @@
             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));
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -159,22 +159,20 @@
     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 @@
         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 @@
     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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -273,21 +273,20 @@
         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++;
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -289,9 +289,9 @@
             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 @@
         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;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -62,9 +62,8 @@
         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);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -409,8 +409,8 @@
             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 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 @@
                     //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 @@
             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 @@
             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 @@
                 // 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 @@
      */
     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();
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -360,8 +360,7 @@
         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));
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageFrameWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -167,25 +167,24 @@
             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);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexFrameWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -85,12 +85,12 @@
         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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageIndexWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -109,13 +109,12 @@
      * @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);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -65,16 +65,13 @@
         // 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 @@
                     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 @@
                 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 =
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageFrameWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -159,24 +159,25 @@
             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);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ProfilePackageIndexFrameWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -93,9 +93,9 @@
         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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SourceToHTMLConverter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -95,21 +95,19 @@
         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 @@
         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 @@
                     return;
                 r = new FileReader(file);
             }
-            LineNumberReader reader = new LineNumberReader(r);
             int lineno = 1;
             String line;
             relativePath = DocPaths.SOURCE_OUTPUT
@@ -169,14 +165,12 @@
                     .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 @@
         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();
         }
 
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/SubWriterHolderWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -95,8 +95,8 @@
         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;
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -197,9 +197,9 @@
     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 &&
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java	Wed Dec 18 10:29:25 2013 -0500
@@ -196,10 +196,8 @@
     }
 
     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 {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/AbstractDoclet.java	Wed Dec 18 10:29:25 2013 -0500
@@ -188,8 +188,8 @@
     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 @@
      */
     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);
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/Configuration.java	Wed Dec 18 10:29:25 2013 -0500
@@ -339,38 +339,39 @@
      */
     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 @@
 
     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 @@
 
         // 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 @@
             }
         }
 
-        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 @@
         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)) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstantsSummaryBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -151,13 +151,12 @@
      */
     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 @@
      * @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 @@
                 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 @@
      * @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 @@
         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 @@
      */
     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;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ConstructorBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -96,9 +96,8 @@
                 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);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/MemberSummaryBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -475,11 +475,9 @@
      */
     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 @@
                 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 @@
         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));
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ProfileSummaryBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -166,8 +166,8 @@
      */
     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(
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/SerializedFormBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -162,9 +162,8 @@
      */
     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 @@
         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 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 @@
         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 @@
      * @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;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ParamTaglet.java	Wed Dec 18 10:29:25 2013 -0500
@@ -106,13 +106,13 @@
         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 @@
             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);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/SimpleTaglet.java	Wed Dec 18 10:29:25 2013 -0500
@@ -112,7 +112,7 @@
         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 @@
      * otherwise.
      */
     public boolean inConstructor() {
-        return locations.indexOf(CONSTRUCTOR) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(CONSTRUCTOR) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -145,7 +145,7 @@
      * otherwise.
      */
     public boolean inField() {
-        return locations.indexOf(FIELD) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(FIELD) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -156,7 +156,7 @@
      * otherwise.
      */
     public boolean inMethod() {
-        return locations.indexOf(METHOD) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(METHOD) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -167,7 +167,7 @@
      * otherwise.
      */
     public boolean inOverview() {
-        return locations.indexOf(OVERVIEW) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(OVERVIEW) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -178,7 +178,7 @@
      * otherwise.
      */
     public boolean inPackage() {
-        return locations.indexOf(PACKAGE) != -1 && locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(PACKAGE) && !locations.contains(EXCLUDED);
     }
 
     /**
@@ -189,7 +189,7 @@
      * otherwise.
      */
     public boolean inType() {
-        return locations.indexOf(TYPE) != -1&& locations.indexOf(EXCLUDED) == -1;
+        return locations.contains(TYPE) && !locations.contains(EXCLUDED);
     }
 
     /**
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Wed Dec 18 10:29:25 2013 -0500
@@ -370,37 +370,37 @@
             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 @@
      * 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));
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -204,30 +204,30 @@
         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 @@
             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;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ThrowsTaglet.java	Wed Dec 18 10:29:25 2013 -0500
@@ -64,19 +64,18 @@
             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 @@
             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 @@
         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 @@
         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 @@
                 }
                 result.addContent(writer.throwsTagOutput(tt));
                 alreadyDocumented.add(cd != null ?
-                    cd.qualifiedName() : tt.exceptionName());
+                                      cd.qualifiedName() : tt.exceptionName());
             }
         }
         return result;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/ValueTaglet.java	Wed Dec 18 10:29:25 2013 -0500
@@ -150,10 +150,9 @@
         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;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassDocCatalog.java	Wed Dec 18 10:29:25 2013 -0500
@@ -100,8 +100,8 @@
      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);
          }
      }
 
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassTree.java	Wed Dec 18 10:29:25 2013 -0500
@@ -123,43 +123,43 @@
      * @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 @@
             }
         }
         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 @@
     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 @@
         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);
                 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ClassUseMapper.java	Wed Dec 18 10:29:25 2013 -0500
@@ -186,44 +186,42 @@
         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 @@
             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 @@
             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 @@
             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 @@
      * 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 @@
         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 @@
         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 @@
         } 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 @@
         } 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 @@
      */
     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);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DeprecatedAPIListBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -85,16 +85,12 @@
      */
     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 @@
             }
             if (cd.isAnnotationType()) {
                 composeDeprecatedList(getList(ANNOTATION_TYPE_MEMBER),
-                        ((AnnotationTypeDoc) cd).elements());
+                                      ((AnnotationTypeDoc) cd).elements());
             }
         }
         sortDeprecatedLists();
@@ -131,9 +127,9 @@
      * @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);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFile.java	Wed Dec 18 10:29:25 2013 -0500
@@ -132,19 +132,15 @@
      * 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 @@
             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);
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/DocFinder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -220,8 +220,8 @@
             //       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) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Extern.java	Wed Dec 18 10:29:25 2013 -0500
@@ -234,11 +234,10 @@
         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);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Group.java	Wed Dec 18 10:29:25 2013 -0500
@@ -185,8 +185,7 @@
         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 @@
      * 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);
             }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/ImplementedMethods.java	Wed Dec 18 10:29:25 2013 -0500
@@ -89,8 +89,7 @@
      */
     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 @@
      */
     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;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/IndexBuilder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -132,8 +132,8 @@
      * 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 @@
         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 @@
         }
         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 @@
      * @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);
             }
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MetaKeywords.java	Wed Dec 18 10:29:25 2013 -0500
@@ -147,10 +147,9 @@
     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);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/MethodFinder.java	Wed Dec 18 10:29:25 2013 -0500
@@ -62,9 +62,9 @@
 
     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;
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/PackageListWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -76,17 +76,16 @@
     }
 
     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);
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Wed Dec 18 10:29:25 2013 -0500
@@ -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 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 @@
      * @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 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 @@
 
                 first = false;
             }
-        } catch (SecurityException exc) {
-            throw new DocletAbortException(exc);
-        } catch (IOException exc) {
+        } catch (SecurityException | IOException exc) {
             throw new DocletAbortException(exc);
         }
     }
@@ -287,18 +287,15 @@
             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 @@
     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 @@
      * @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 @@
             || !(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 @@
         // 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 @@
      * @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 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 @@
             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;
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/VisibleMemberMap.java	Wed Dec 18 10:29:25 2013 -0500
@@ -173,8 +173,7 @@
      */
     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 @@
     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 @@
     }
 
     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 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 @@
         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 @@
         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 @@
             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 @@
             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 @@
     }
 
     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)) {
--- a/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/doclint/DocLint.java	Wed Dec 18 10:29:25 2013 -0500
@@ -257,8 +257,7 @@
 
     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)) {
--- a/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java	Wed Dec 18 10:29:25 2013 -0500
@@ -218,9 +218,7 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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 @@
                 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);
             }
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/FSInfo.java	Wed Dec 18 10:29:25 2013 -0500
@@ -64,8 +64,7 @@
 
     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 @@
 
             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();
         }
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/RegularFileObject.java	Wed Dec 18 10:29:25 2013 -0500
@@ -109,8 +109,7 @@
     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 @@
                 if (!ignoreEncodingErrors) {
                     fileManager.cache(this, cb);
                 }
-            } finally {
-                in.close();
             }
         }
         return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipArchive.java	Wed Dec 18 10:29:25 2013 -0500
@@ -205,8 +205,7 @@
         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 @@
                     if (!ignoreEncodingErrors) {
                         fileManager.cache(this, cb);
                     }
-                } finally {
-                    in.close();
                 }
             }
             return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java	Wed Dec 18 10:29:25 2013 -0500
@@ -162,8 +162,7 @@
         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 @@
                     fileManager.recycleByteBuffer(bb); // save for next time
                     if (!ignoreEncodingErrors)
                         fileManager.cache(this, cb);
-                } finally {
-                    in.close();
                 }
             }
             return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java	Wed Dec 18 10:29:25 2013 -0500
@@ -113,14 +113,12 @@
     }
 
     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);
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/jvm/JNIWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -697,7 +697,7 @@
 
             // 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 @@
 
             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 @@
             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;
--- a/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/CommandLine.java	Wed Dec 18 10:29:25 2013 -0500
@@ -55,8 +55,7 @@
         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 @@
     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();
     }
 }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Wed Dec 18 10:29:25 2013 -0500
@@ -726,13 +726,10 @@
             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;
         }
--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Dec 18 10:29:25 2013 -0500
@@ -458,10 +458,8 @@
                     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 @@
                 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)
--- a/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/nio/PathFileObject.java	Wed Dec 18 10:29:25 2013 -0500
@@ -219,8 +219,7 @@
     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 @@
                 if (!ignoreEncodingErrors) {
                     fileManager.cache(this, cb);
                 }
-            } finally {
-                in.close();
             }
         }
         return cb;
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/CreateSymbols.java	Wed Dec 18 10:29:25 2013 -0500
@@ -265,9 +265,7 @@
                     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);
         }
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/sym/Profiles.java	Wed Dec 18 10:29:25 2013 -0500
@@ -69,30 +69,24 @@
             }
 
             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();
         }
     }
 
--- a/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/BasicDiagnosticFormatter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -137,7 +137,7 @@
             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
--- a/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/Convert.java	Wed Dec 18 10:29:25 2013 -0500
@@ -63,8 +63,8 @@
             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 @@
             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)
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ListBuffer.java	Wed Dec 18 10:29:25 2013 -0500
@@ -156,8 +156,8 @@
     /** 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;
     }
--- a/langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javac/util/ServiceLoader.java	Wed Dec 18 10:29:25 2013 -0500
@@ -169,7 +169,6 @@
         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 @@
             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);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/ClassDocImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -971,9 +971,8 @@
         }
 
         // 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 @@
         }
 
         // 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;
--- a/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/Comment.java	Wed Dec 18 10:29:25 2013 -0500
@@ -151,29 +151,39 @@
                     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);
                 }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocLocale.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocLocale.java	Wed Dec 18 10:29:25 2013 -0500
@@ -159,12 +159,11 @@
      */
     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 @@
      * 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;
--- a/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/DocletInvoker.java	Wed Dec 18 10:29:25 2013 -0500
@@ -210,7 +210,7 @@
         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 @@
                 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 @@
                 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);
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Wed Dec 18 10:29:25 2013 -0500
@@ -385,10 +385,9 @@
     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;
                 }
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SerializedForm.java	Wed Dec 18 10:29:25 2013 -0500
@@ -234,20 +234,19 @@
                                                        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;
                 }
             }
--- a/langtools/src/share/classes/com/sun/tools/javah/JavahTool.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javah/JavahTool.java	Wed Dec 18 10:29:25 2013 -0500
@@ -74,10 +74,9 @@
     }
 
     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;
     }
--- a/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javah/TypeSignature.java	Wed Dec 18 10:29:25 2013 -0500
@@ -121,7 +121,7 @@
 
         // 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 @@
 
         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 @@
         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;
--- a/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/AnnotationWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -219,8 +219,7 @@
                 Descriptor d = new Descriptor(index);
                 print(d.getFieldType(constant_pool));
                 return;
-            } catch (ConstantPoolException ignore) {
-            } catch (InvalidDescriptor ignore) {
+            } catch (ConstantPoolException | InvalidDescriptor ignore) {
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/JavapTask.java	Wed Dec 18 10:29:25 2013 -0500
@@ -758,8 +758,7 @@
                     }
 
                 };
-            } catch (URISyntaxException ignore) {
-            } catch (IOException ignore) {
+            } catch (URISyntaxException | IOException ignore) {
             }
         }
 
--- a/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/javap/StackMapWriter.java	Wed Dec 18 10:29:25 2013 -0500
@@ -82,9 +82,7 @@
             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);
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Log.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Log.java	Wed Dec 18 10:29:25 2013 -0500
@@ -75,11 +75,14 @@
         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() {
--- a/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/com/sun/tools/sjavac/Main.java	Wed Dec 18 10:29:25 2013 -0500
@@ -749,8 +749,9 @@
      * 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;
     }
--- a/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Tue Dec 17 19:27:49 2013 -0500
+++ b/langtools/src/share/classes/javax/lang/model/SourceVersion.java	Wed Dec 18 10:29:25 2013 -0500
@@ -158,12 +158,14 @@
         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;