changeset 1674:4f320963f124

Merge
author goetz
date Fri, 25 Oct 2013 14:27:09 +0200
parents 661bd4141475 (current diff) b19e375d9829 (diff)
children 37fca9892869
files .hgtags
diffstat 32 files changed, 462 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Tue Sep 17 16:34:04 2013 +0200
+++ b/.hgtags	Fri Oct 25 14:27:09 2013 +0200
@@ -305,6 +305,22 @@
 17ee569d0c0130824ba27bc1b090114e6075c5f2 jdk7u25-b09
 41c1b02cd6a8fa7746752cc911da3dd4d380098d jdk7u25-b10
 0da9ef0d9fc5b017f960d65ae0cd07860a259621 jdk7u25-b11
+cf80c545434cfe44034e667079673ce42cc9cdbf jdk7u14-b16
+aecd58f25d7f21827ae1b020ae8cfb44857c439f jdk7u14-b17
+577f9625ec558c18e9de6e3428fd0f9cca823033 jdk7u14-b18
+5168a2c7af619364ddb342674ff880874c3b7897 jdk7u14-b19
+5168a2c7af619364ddb342674ff880874c3b7897 jdk7u14-b19
+e8c876a77def120b5eeb26535d0777c9b9f842f8 jdk7u14-b19
+86ae75a68cc375cfc0559699b5270951aab09eb0 jdk7u14-b20
+c31648d7a6ac692371f1e9abe95bc2856a7dc51c jdk7u14-b21
+eb1c9eacea1f07c07e7e700db624649d3573dae4 jdk7u14-b22
+e84535d2c292032669ac75a6a0afc5f23c708064 jdk7u40-b23
+d2b78e3b352dfb9b0cbd808669f9332e898147ed jdk7u40-b24
+e5635f70fe67192142cb5166bee08cc915a18bc4 jdk7u40-b25
+5bd6f156bc01b6a4e901fc5607663dfc249e9105 jdk7u40-b26
+12506bba2b67cd4b229550da67ff85b984549a28 jdk7u40-b27
+9f2eea2fae59c5242d1bb4cbca967bb6fbb99865 jdk7u40-b28
+bfe3575143fddbf71c2e570b580afef007d171e4 jdk7u40-b29
 28358b2489b2ca29c1a6b79f643204da8924a3d7 jdk7u25-b12
 5ed8c453480063838b632c74f528924f529361a2 jdk7u25-b13
 c6342ec6a12f7283e2a73a80a44dcdd3683e2e8b jdk7u25-b14
@@ -347,3 +363,27 @@
 765bea9bfcfc8c472df0a2daced5e576095f46ac jdk7u40-b42
 988ece7b686564084770e99ca26746c45ffb933f jdk7u40-b43
 a67dbf96bf86989d0392cc5b66e5d4139cbceec7 jdk7u40-b60
+849b17bc6e9a08fa41e0ef631e51366a09842e64 jdk7u60-b00
+b2e29b79e54e58349c1dbcf5449f67fc5d5a235a jdk7u40-b61
+94ea3d062a3c28c64a837fa8f999c6b6956ff7c4 jdk7u40-b62
+9bbfba4981e1db5016bbfbc23025763966021c26 jdk7u45-b01
+61d5b73ae0ac46268490e2f0dfa1f69a5acda73f jdk7u45-b02
+2fe27ae865e723473225756f1920d9d76d47b903 jdk7u45-b03
+bede296dc848533abae859e61584a517df2773ae jdk7u45-b04
+e989f2f2b5cb639a23a5e67da0d52766acf549a2 jdk7u45-b05
+6f492dc935adc6e2878bb6045aee001a829428a7 jdk7u45-b06
+4c51f98e1eb5b8d94dfca08f3b3160ff382b7c3a jdk7u45-b07
+6cf97c9859e731fba6bcff67c46f57dead8d7284 jdk7u45-b08
+a9c31d3f8188b344ed165ec0730ebc2fd11dfa5d jdk7u45-b09
+2c09352066ec34c8608ccff0f933f566a52033af jdk7u45-b10
+53d5c06766b05689cdccfc300b32075878e8aa1d jdk7u45-b11
+0b6aa6e95eb9da58a686edacf5b102116614d3ea jdk7u45-b12
+68862f365075a11dfa291033d05a062590db9337 jdk7u45-b13
+8c799b9f0cd8af3b1cfd151ba075a4f1630967df jdk7u45-b14
+36ae3f206b53f751a0ebf933e5dbf364097b48a5 jdk7u45-b15
+18d1864abca976ca68cb71612e9b20c908455d3d jdk7u45-b16
+b9aeec6b9d5aac0746f8d1764a7740f8b83334ab jdk7u45-b17
+ba3ff27d4082f2cf0d06e635b2b6e01f80e78589 jdk7u45-b18
+164cf7491ba2f371354ba343a604eee4c61c529d jdk7u45-b30
+7f5cfaedb25c2c2774d6839810d6ae543557ca01 jdk7u45-b31
+849b17bc6e9a08fa41e0ef631e51366a09842e64 jdk7u60-b00
--- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlWriter.java	Fri Oct 25 14:27:09 2013 +0200
@@ -292,7 +292,7 @@
             script.addAttr(HtmlAttr.TYPE, "text/javascript");
             String scriptCode = "<!--" + DocletConstants.NL +
                     "    if (location.href.indexOf('is-external=true') == -1) {" + DocletConstants.NL +
-                    "        parent.document.title=\"" + winTitle + "\";" + DocletConstants.NL +
+                    "        parent.document.title=\"" + escapeJavaScriptChars(winTitle) + "\";" + DocletConstants.NL +
                     "    }" + DocletConstants.NL +
                     "//-->" + DocletConstants.NL;
             RawHtml scriptContent = new RawHtml(scriptCode);
@@ -302,6 +302,53 @@
     }
 
     /**
+     * Returns a String with escaped special JavaScript characters.
+     *
+     * @param s String that needs to be escaped
+     * @return a valid escaped JavaScript string
+     */
+    private static String escapeJavaScriptChars(String s) {
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < s.length(); i++) {
+            char ch = s.charAt(i);
+            switch (ch) {
+                case '\b':
+                    sb.append("\\b");
+                    break;
+                case '\t':
+                    sb.append("\\t");
+                    break;
+                case '\n':
+                    sb.append("\\n");
+                    break;
+                case '\f':
+                    sb.append("\\f");
+                    break;
+                case '\r':
+                    sb.append("\\r");
+                    break;
+                case '"':
+                    sb.append("\\\"");
+                    break;
+                case '\'':
+                    sb.append("\\\'");
+                    break;
+                case '\\':
+                    sb.append("\\\\");
+                    break;
+                default:
+                    if (ch < 32 || ch >= 127) {
+                        sb.append(String.format("\\u%04X", (int)ch));
+                    } else {
+                        sb.append(ch);
+                    }
+                    break;
+            }
+        }
+        return sb.toString();
+    }
+
+    /**
      * Returns a content tree for the SCRIPT tag for the main page(index.html).
      *
      * @return a content for the SCRIPT tag
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Tue Sep 17 16:34:04 2013 +0200
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/resources/doclets.properties	Fri Oct 25 14:27:09 2013 +0200
@@ -182,25 +182,32 @@
 doclet.0_and_1={0} and {1}
 
 #Documentation for Enums
-doclet.enum_values_doc=\n\
+doclet.enum_values_doc.main=\n\
  Returns an array containing the constants of this enum type, in\n\
  the order they are declared.  This method may be used to iterate\n\
  over the constants as follows:\n\
  <pre>\n\
  for ({0} c : {0}.values())\n\
  &nbsp;   System.out.println(c);\n\
- </pre>\n\
- @return an array containing the constants of this enum type, in\n\
- the order they are declared
+ </pre>
 
-doclet.enum_valueof_doc=\n\
+doclet.enum_values_doc.return=\n\
+ an array containing the constants of this enum type, in the order they are declared
+
+doclet.enum_valueof_doc.main=\n\
  Returns the enum constant of this type with the specified name.\n\
  The string must match <i>exactly</i> an identifier used to declare an\n\
  enum constant in this type.  (Extraneous whitespace characters are \n\
- not permitted.)\n\
- \n\
- @param name the name of the enum constant to be returned.\n\
- @return the enum constant with the specified name\n\
- @throws IllegalArgumentException if this enum type has no constant\n\
-         with the specified name\n\
- @throws NullPointerException if the argument is null
+ not permitted.)
+
+doclet.enum_valueof_doc.param_name=\
+ the name of the enum constant to be returned.
+
+doclet.enum_valueof_doc.return=\
+ the enum constant with the specified name
+
+doclet.enum_valueof_doc.throws_ila=\
+ if this enum type has no constant with the specified name
+
+doclet.enum_valueof_doc.throws_npe=\
+ if the argument is null
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/Util.java	Fri Oct 25 14:27:09 2013 +0200
@@ -852,16 +852,28 @@
         for (int j = 0; j < methods.length; j++) {
             MethodDoc currentMethod = methods[j];
             if (currentMethod.name().equals("values") &&
-                currentMethod.parameters().length == 0) {
-                currentMethod.setRawCommentText(
-                    configuration.getText("doclet.enum_values_doc", classDoc.name()));
+                    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())) {
-                    currentMethod.setRawCommentText(
-                        configuration.getText("doclet.enum_valueof_doc"));
+                        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());
                 }
             }
         }
--- a/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/src/share/classes/com/sun/tools/javac/parser/Scanner.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -501,11 +501,10 @@
     private void scanIdent() {
         boolean isJavaIdentifierPart;
         char high;
+        if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
+        // optimization, was: putChar(ch);
+        scanChar();
         do {
-            if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
-            // optimization, was: putChar(ch);
-
-            scanChar();
             switch (ch) {
             case 'A': case 'B': case 'C': case 'D': case 'E':
             case 'F': case 'G': case 'H': case 'I': case 'J':
@@ -522,6 +521,7 @@
             case '$': case '_':
             case '0': case '1': case '2': case '3': case '4':
             case '5': case '6': case '7': case '8': case '9':
+                break;
             case '\u0000': case '\u0001': case '\u0002': case '\u0003':
             case '\u0004': case '\u0005': case '\u0006': case '\u0007':
             case '\u0008': case '\u000E': case '\u000F': case '\u0010':
@@ -529,30 +529,37 @@
             case '\u0015': case '\u0016': case '\u0017':
             case '\u0018': case '\u0019': case '\u001B':
             case '\u007F':
-                break;
+                scanChar();
+                continue;
             case '\u001A': // EOI is also a legal identifier part
                 if (bp >= buflen) {
                     name = names.fromChars(sbuf, 0, sp);
                     token = keywords.key(name);
                     return;
                 }
-                break;
+                scanChar();
+                continue;
             default:
                 if (ch < '\u0080') {
                     // all ASCII range chars already handled, above
                     isJavaIdentifierPart = false;
                 } else {
-                    high = scanSurrogates();
-                    if (high != 0) {
-                        if (sp == sbuf.length) {
-                            putChar(high);
+                    if (Character.isIdentifierIgnorable(ch)) {
+                        scanChar();
+                        continue;
+                    } else {
+                        high = scanSurrogates();
+                        if (high != 0) {
+                            if (sp == sbuf.length) {
+                                putChar(high);
+                            } else {
+                                sbuf[sp++] = high;
+                            }
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(
+                                Character.toCodePoint(high, ch));
                         } else {
-                            sbuf[sp++] = high;
+                            isJavaIdentifierPart = Character.isJavaIdentifierPart(ch);
                         }
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(
-                            Character.toCodePoint(high, ch));
-                    } else {
-                        isJavaIdentifierPart = Character.isJavaIdentifierPart(ch);
                     }
                 }
                 if (!isJavaIdentifierPart) {
@@ -561,6 +568,9 @@
                     return;
                 }
             }
+            if (sp == sbuf.length) putChar(ch); else sbuf[sp++] = ch;
+            // optimization, was: putChar(ch);
+            scanChar();
         } while (true);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/TestWindowTitle.java	Fri Oct 25 14:27:09 2013 +0200
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8016675
+ * @summary Test for window title.
+ * @author Bhavesh Patel
+ * @library ../lib/
+ * @build JavadocTester TestWindowTitle
+ * @run main TestWindowTitle
+ */
+
+public class TestWindowTitle extends JavadocTester {
+
+    private static final String BUG_ID = "8016675";
+    private static final String WIN_TITLE =
+            "Testing \"Window 'Title'\" with a \\ backslash and a / " +
+            "forward slash and a \u00e8 unicode char also a    tab and also a " +
+            "\t special character another \u0002 unicode)";
+    private static final String[][] TEST = {
+        {BUG_ID + FS  + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \\\"Window \\\'Title\\\'\\\" " +
+            "with a \\\\ backslash and a / forward slash and a \\u00E8 unicode char " +
+            "also a    tab and also a \\t special character another \\u0002 unicode))\";"
+        },
+    };
+    private static final String[][] NEG_TEST = {
+        {BUG_ID + FS + "overview-summary.html",
+            "parent.document.title=\"Overview (Testing \"Window \'Title\'\" " +
+            "with a \\ backslash and a / forward slash and a \u00E8 unicode char " +
+            "also a    tab and also a \t special character another \u0002 unicode))\";"
+        },
+    };
+    private static final String[] ARGS = new String[]{
+        "-d", BUG_ID, "-windowtitle", WIN_TITLE, "-sourcepath", SRC_DIR, "p1", "p2"
+    };
+
+    /**
+     * The entry point of the test.
+     * @param args the array of command line arguments.
+     */
+    public static void main(String[] args) {
+        TestWindowTitle tester = new TestWindowTitle();
+        run(tester, ARGS, TEST, NEG_TEST);
+        tester.printSummary();
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugId() {
+        return BUG_ID;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getBugName() {
+        return getClass().getName();
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/p1/C1.java	Fri Oct 25 14:27:09 2013 +0200
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p1;
+
+public class C1 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/com/sun/javadoc/testWindowTitle/p2/C2.java	Fri Oct 25 14:27:09 2013 +0200
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package p2;
+
+public class C2 {
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/7144981/IgnoreIgnorableCharactersInInput.java	Fri Oct 25 14:27:09 2013 +0200
@@ -0,0 +1,92 @@
+
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7144981
+ * @summary javac should ignore ignorable characters in input
+ * @run main IgnoreIgnorableCharactersInInput
+ */
+
+import com.sun.source.util.JavacTask;
+import java.io.File;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Set;
+import java.util.TreeSet;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.ToolProvider;
+
+public class IgnoreIgnorableCharactersInInput {
+
+    public static void main(String... args) throws Exception {
+        new IgnoreIgnorableCharactersInInput().run();
+    }
+
+    void run() throws Exception {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        File classesDir = new File(System.getProperty("user.dir"), "classes");
+        classesDir.mkdirs();
+        JavaSource[] sources = new JavaSource[]{
+            new JavaSource("TestOneIgnorableChar", "AA\\u0000BB"),
+            new JavaSource("TestMultipleIgnorableChar", "AA\\u0000\\u0000\\u0000BB")};
+        JavacTask ct = (JavacTask)comp.getTask(null, null, null,
+                Arrays.asList("-d", classesDir.getPath()),
+                null, Arrays.asList(sources));
+        try {
+            if (!ct.call()) {
+                throw new AssertionError("Error thrown when compiling test cases");
+            }
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling test cases");
+        }
+        check(classesDir,
+                "TestOneIgnorableChar.class",
+                "TestOneIgnorableChar$AABB.class",
+                "TestMultipleIgnorableChar.class",
+                "TestMultipleIgnorableChar$AABB.class");
+        if (errors > 0)
+            throw new AssertionError("There are some errors in the test check the error output");
+    }
+
+    /**
+     *  Check that a directory contains the expected files.
+     */
+    void check(File dir, String... paths) {
+        Set<String> found = new TreeSet<String>(Arrays.asList(dir.list()));
+        Set<String> expect = new TreeSet<String>(Arrays.asList(paths));
+        if (found.equals(expect))
+            return;
+        for (String f: found) {
+            if (!expect.contains(f))
+                error("Unexpected file found: " + f);
+        }
+        for (String e: expect) {
+            if (!found.contains(e))
+                error("Expected file not found: " + e);
+        }
+    }
+
+    int errors;
+
+    void error(String msg) {
+        System.err.println(msg);
+        errors++;
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String internalSource =
+            "public class #O {public class #I {} }";
+        public JavaSource(String outerClassName, String innerClassName) {
+            super(URI.create(outerClassName + ".java"), JavaFileObject.Kind.SOURCE);
+            internalSource =
+                    internalSource.replace("#O", outerClassName).replace("#I", innerClassName);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return internalSource;
+        }
+    }
+}
--- a/test/tools/javac/api/6406133/T6406133.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6406133/T6406133.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Compiler API ignores locale settings
  * @author  Maurizio Cimadamore
  * @library ../lib
+ * @build ToolTester
+ * @run main T6406133
  */
 
 import javax.tools.*;
--- a/test/tools/javac/api/6410643/T6410643.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6410643/T6410643.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary JSR 199: The method JavaCompilerTool.run fails to handle null arguments
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
+ * @run main T6410643
  */
 
 import javax.tools.JavaFileObject;
--- a/test/tools/javac/api/6411310/T6411310.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6411310/T6411310.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary JSR 199: FileObject should support user-friendly names via getName()
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6411310.java
  * @run main T6411310
  */
--- a/test/tools/javac/api/6411333/T6411333.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6411333/T6411333.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary Ensure 6400208, 6400225, and 6400267 are tested
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6411333.java
  * @run main T6411333
  */
--- a/test/tools/javac/api/6412656/T6412656.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6412656/T6412656.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary JSR 199: pass annotation processor instances to compiler
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
+ * @run main T6412656
  */
 
 import java.util.Set;
--- a/test/tools/javac/api/6415780/T6415780.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6415780/T6415780.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,8 @@
  * @author  igor.tseytin@...
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
+ * @run main T6415780
  */
 
 import static javax.tools.StandardLocation.CLASS_PATH;
--- a/test/tools/javac/api/6418694/T6418694.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6418694/T6418694.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary JSR 199: JavaFileManager.hasLocation(Location)
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6418694.java
  * @run main T6418694
  */
--- a/test/tools/javac/api/6421111/T6421111.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6421111/T6421111.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary NullPointerException thrown when retrieving bounds for the type parameter
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile -Xlint:all T6421111.java
  * @run main T6421111
  */
--- a/test/tools/javac/api/6421756/T6421756.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6421756/T6421756.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary 6421756 JSR 199: In the method JavaCompilerTool.getTask 'options' can be supplied in the place of 'classes'
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6421756.java
  * @run main T6421756
  */
--- a/test/tools/javac/api/6422215/T6422215.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6422215/T6422215.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary JSR 199: What happens if a directory is missing
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
+ * @run main T6422215
  */
 
 import java.io.File;
--- a/test/tools/javac/api/6422327/T6422327.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6422327/T6422327.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary JSR 199: JavaCompilerTool can compile and generate '.class' of non '.java' files
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
+ * @run main T6422327
  */
 
 import java.io.File;
--- a/test/tools/javac/api/6423003/T6423003.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6423003/T6423003.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary JSR 199: confusing help message with compiler API
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6423003.java
  * @run main T6423003
  */
--- a/test/tools/javac/api/6431257/T6431257.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6431257/T6431257.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary JSR 199: Changes to JavaFileManager to support JSR 269 Filer API
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6431257.java package-info.java
  * @run main T6431257 foo.bar.baz foo/bar/baz
  */
--- a/test/tools/javac/api/6437349/T6437349.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6437349/T6437349.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
  * @bug     6437349
  * @summary JSR 199: JavaFileObject.isNameCompatible() will give true with some incompatible kinds
  * @library ../lib
+ * @build ToolTester
  * @compile T6437349.java
  * @run main T6437349
  */
--- a/test/tools/javac/api/6437999/T6437999.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6437999/T6437999.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary Unit test for encoding argument to standard file manager
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6437999.java
  * @run main T6437999
  */
--- a/test/tools/javac/api/6440333/T6440333.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6440333/T6440333.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary SimpleJavaFileObject.toString() generates URI with some extra message
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6440333.java
  * @run main T6440333
  */
--- a/test/tools/javac/api/6440528/T6440528.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6440528/T6440528.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary javac deposits package-info.class in bogus directory
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6440528.java
  * @run main T6440528
  */
--- a/test/tools/javac/api/6468404/T6468404.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6468404/T6468404.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @author  jesse.glick@...
  * @author  Peter von der Ah\u00e9
  * @library ../lib
+ * @build ToolTester
  * @compile T6468404.java
  * @run main T6468404
  */
--- a/test/tools/javac/api/6731573/T6731573.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6731573/T6731573.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary diagnostic output should optionally include source line
  * @author  Maurizio Cimadamore
  * @library ../lib
+ * @build ToolTester
+ * @run main T6731573
  */
 
 import java.io.*;
--- a/test/tools/javac/api/6733837/T6733837.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/6733837/T6733837.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
  * @summary Compiler API ignores locale settings
  * @author  Maurizio Cimadamore
  * @library ../lib
+ * @build ToolTester
+ * @run main T6733837
  */
 
 import java.io.StringWriter;
--- a/test/tools/javac/api/TestJavacTaskScanner.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/TestJavacTaskScanner.java	Fri Oct 25 14:27:09 2013 +0200
@@ -27,6 +27,7 @@
  * @summary Additional functionality test of task and JSR 269
  * @author  Peter von der Ah\u00e9
  * @library ./lib
+ * @build ToolTester
  * @run main TestJavacTaskScanner TestJavacTaskScanner.java
  */
 
@@ -159,7 +160,7 @@
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
         try {
             fm.setLocation(SOURCE_PATH,  Arrays.asList(test_src));
-            fm.setLocation(CLASS_PATH,   Arrays.asList(test_classes, javac_classes));
+            fm.setLocation(CLASS_PATH,   join(test_class_path, Arrays.asList(javac_classes)));
             fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
         } catch (IOException e) {
             throw new AssertionError(e);
--- a/test/tools/javac/api/guide/Test.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/guide/Test.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,7 @@
  * @summary Various bugs fixed while writing Compiler API Guide
  * @author  Peter von der Ah\u0081
  * @library ../lib
+ * @build ToolTester
  * @compile Test.java
  * @run main Test
  */
--- a/test/tools/javac/api/lib/ToolTester.java	Tue Sep 17 16:34:04 2013 +0200
+++ b/test/tools/javac/api/lib/ToolTester.java	Fri Oct 25 14:27:09 2013 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 import java.io.File;
 import java.io.IOException;
 import java.nio.charset.Charset;
-import java.util.Arrays;
+import java.util.*;
 import javax.tools.*;
 
 import static javax.tools.StandardLocation.CLASS_PATH;
@@ -34,6 +34,8 @@
 public class ToolTester {
     public final File test_src     = new File(System.getProperty("test.src", "."));
     public final File test_classes = new File(System.getProperty("test.classes", "."));
+    public final List<File> test_class_path = pathToFiles(System.getProperty("test.class.path"),
+                                     Arrays.asList(test_classes));
     public final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
     public final StandardJavaFileManager fm = getFileManager(tool, null, null);
     public JavaCompiler.CompilationTask task = null;
@@ -43,11 +45,36 @@
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
         try {
             fm.setLocation(SOURCE_PATH,  Arrays.asList(test_src));
-            fm.setLocation(CLASS_PATH,   Arrays.asList(test_classes));
+            fm.setLocation(CLASS_PATH,   test_class_path);
             fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
         } catch (IOException e) {
             throw new AssertionError(e);
         }
         return fm;
     }
+
+    protected List<File> pathToFiles(String path, List<File> defaultPath) {
+        List<File> files = new ArrayList<>();
+        for (String f: path.split(File.pathSeparator)) {
+            if (f.isEmpty())
+                continue;
+            File file = new File(f);
+            if (file.exists())
+                files.add(file);
+        }
+        if (files.isEmpty())
+            files.addAll(defaultPath);
+        return files;
+    }
+
+    protected <T> List<T> join(List<T> a, List<T> b) {
+        if (a.isEmpty())
+            return b;
+        if (b.isEmpty())
+            return a;
+        List<T> result = new ArrayList<>();
+        result.addAll(a);
+        result.addAll(b);
+        return result;
+    }
 }