langtools/test/tools/javac/6508981/TestInferBinaryName.java
author mikejwre
Wed, 09 Jun 2010 18:56:41 -0700
changeset 5634 895b66935810
parent 5520 86e4b9a9da40
child 8432 d3380b1e4779
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1205
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     1
/*
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1205
diff changeset
     2
 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
1205
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     4
 *
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     7
 * published by the Free Software Foundation.
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     8
 *
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    13
 * accompanied this code).
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    14
 *
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    18
 *
5520
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1205
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1205
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
86e4b9a9da40 6943119: Rebrand source copyright notices
ohair
parents: 1205
diff changeset
    21
 * questions.
1205
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    22
 */
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    23
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    24
/*
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    25
 * @test
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    26
 * @bug 6508981
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    27
 * @summary cleanup file separator handling in JavacFileManager
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    28
 * (This test is specifically to test the new impl of inferBinaryName)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    29
 * @build p.A
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    30
 * @run main TestInferBinaryName
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    31
 */
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    32
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    33
import java.io.*;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    34
import java.util.*;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    35
import javax.tools.*;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    36
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    37
import com.sun.tools.javac.file.JavacFileManager;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    38
import com.sun.tools.javac.util.Context;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    39
import com.sun.tools.javac.util.Options;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    40
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    41
import static javax.tools.JavaFileObject.Kind.*;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    42
import static javax.tools.StandardLocation.*;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    43
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    44
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    45
/**
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    46
 * Verify the various implementations of inferBinaryName, but configuring
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    47
 * different instances of a file manager, getting a file object, and checking
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    48
 * the impl of inferBinaryName for that file object.
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    49
 */
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    50
public class TestInferBinaryName {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    51
    static final boolean IGNORE_SYMBOL_FILE = false;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    52
    static final boolean USE_SYMBOL_FILE = true;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    53
    static final boolean DONT_USE_ZIP_FILE_INDEX = false;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    54
    static final boolean USE_ZIP_FILE_INDEX = true;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    55
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    56
    public static void main(String... args) throws Exception {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    57
        new TestInferBinaryName().run();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    58
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    59
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    60
    void run() throws Exception {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    61
        //System.err.println(System.getProperties());
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    62
        testDirectory();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    63
        testSymbolArchive();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    64
        testZipArchive();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    65
        testZipFileIndexArchive();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    66
        testZipFileIndexArchive2();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    67
        if (errors > 0)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    68
            throw new Exception(errors + " error found");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    69
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    70
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    71
    void testDirectory() throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    72
        String testClassName = "p.A";
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    73
        JavaFileManager fm =
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    74
            getFileManager("test.classes", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    75
        test("testDirectory",
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    76
             fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    77
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    78
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    79
    void testSymbolArchive() throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    80
        String testClassName = "java.lang.String";
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    81
        JavaFileManager fm =
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    82
            getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    83
        test("testSymbolArchive",
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    84
             fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    85
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    86
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    87
    void testZipArchive() throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    88
        String testClassName = "java.lang.String";
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    89
        JavaFileManager fm =
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    90
            getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    91
        test("testZipArchive",
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    92
             fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    93
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    94
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    95
    void testZipFileIndexArchive() throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    96
        String testClassName = "java.lang.String";
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    97
        JavaFileManager fm =
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    98
            getFileManager("sun.boot.class.path", USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
    99
        test("testZipFileIndexArchive",
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   100
             fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   101
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   102
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   103
    void testZipFileIndexArchive2() throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   104
        String testClassName = "java.lang.String";
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   105
        JavaFileManager fm =
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   106
            getFileManager("sun.boot.class.path", IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   107
        test("testZipFileIndexArchive2",
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   108
             fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   109
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   110
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   111
    /**
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   112
     * @param testName for debugging
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   113
     * @param fm suitably configured file manager
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   114
     * @param testClassName the classname to test
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   115
     * @param implClassName the expected classname of the JavaFileObject impl,
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   116
     *     used for checking that we are checking the expected impl of
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   117
     *     inferBinaryName
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   118
     */
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   119
    void test(String testName,
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   120
              JavaFileManager fm, String testClassName, String implClassName) throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   121
        JavaFileObject fo = fm.getJavaFileForInput(CLASS_PATH, testClassName, CLASS);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   122
        if (fo == null) {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   123
            System.err.println("Can't find " + testClassName);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   124
            errors++;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   125
            return;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   126
        }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   127
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   128
        String cn = fo.getClass().getName();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   129
        String bn = fm.inferBinaryName(CLASS_PATH, fo);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   130
        System.err.println(testName + " " + cn + " " + bn);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   131
        check(cn, implClassName);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   132
        check(bn, testClassName);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   133
        System.err.println("OK");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   134
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   135
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   136
    JavaFileManager getFileManager(String classpathProperty,
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   137
                                   boolean symFileKind,
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   138
                                   boolean zipFileIndexKind)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   139
            throws IOException {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   140
        Context ctx = new Context();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   141
        // uugh, ugly back door, should be cleaned up, someday
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   142
        if (zipFileIndexKind == USE_ZIP_FILE_INDEX)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   143
            System.clearProperty("useJavaUtilZip");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   144
        else
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   145
            System.setProperty("useJavaUtilZip", "true");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   146
        Options options = Options.instance(ctx);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   147
        if (symFileKind == IGNORE_SYMBOL_FILE)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   148
            options.put("ignore.symbol.file", "true");
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   149
        JavacFileManager fm = new JavacFileManager(ctx, false, null);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   150
        List<File> path = getPath(System.getProperty(classpathProperty));
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   151
        fm.setLocation(CLASS_PATH, path);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   152
        return fm;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   153
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   154
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   155
    List<File> getPath(String s) {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   156
        List<File> path = new ArrayList<File>();
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   157
        for (String f: s.split(File.pathSeparator)) {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   158
            if (f.length() > 0)
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   159
                path.add(new File(f));
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   160
        }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   161
        //System.err.println("path: " + path);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   162
        return path;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   163
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   164
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   165
    void check(String found, String expect) {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   166
        if (!found.equals(expect)) {
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   167
            System.err.println("Expected: " + expect);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   168
            System.err.println("   Found: " + found);
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   169
            errors++;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   170
        }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   171
    }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   172
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   173
    private int errors;
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   174
}
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   175
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   176
class A { }
b316e32eb90c 6508981: cleanup file separator handling in JavacFileManager
jjg
parents:
diff changeset
   177