test/tools/javac/T6625520.java

Wed, 14 Nov 2018 10:18:25 -0800

author
diazhou
date
Wed, 14 Nov 2018 10:18:25 -0800
changeset 3762
7909abb85562
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

Added tag jdk8u201-b04 for changeset a7f48b9dfb82

jjg@56 1 /*
ohair@554 2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
jjg@56 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@56 4 *
jjg@56 5 * This code is free software; you can redistribute it and/or modify it
jjg@56 6 * under the terms of the GNU General Public License version 2 only, as
jjg@56 7 * published by the Free Software Foundation.
jjg@56 8 *
jjg@56 9 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@56 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@56 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@56 12 * version 2 for more details (a copy is included in the LICENSE file that
jjg@56 13 * accompanied this code).
jjg@56 14 *
jjg@56 15 * You should have received a copy of the GNU General Public License version
jjg@56 16 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@56 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@56 18 *
ohair@554 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 20 * or visit www.oracle.com if you need additional information or have any
ohair@554 21 * questions.
jjg@56 22 */
jjg@56 23
jjg@56 24 import java.io.*;
jjg@56 25 import java.util.*;
jjg@56 26 import javax.tools.*;
jjg@56 27 import com.sun.tools.javac.file.*;
jjg@58 28 import com.sun.tools.javac.file.JavacFileManager;
jjg@56 29 import com.sun.tools.javac.util.*;
jjg@56 30
jjg@56 31 /*
jjg@56 32 * @test
jjg@56 33 * @bug 6625520
jjg@56 34 * @summary javac handles missing entries on classpath badly
jjg@56 35 */
jjg@56 36 public class T6625520 {
jjg@56 37 public static void main(String[] args) throws Exception {
jjg@56 38 new T6625520().run();
jjg@56 39 }
jjg@56 40
jjg@56 41 void run() throws Exception {
jjg@56 42 Context c = new Context();
jjg@56 43 DiagnosticCollector<JavaFileObject> dc =
jjg@56 44 new DiagnosticCollector<JavaFileObject>();
jjg@56 45 c.put(DiagnosticListener.class, dc);
jjg@56 46 StandardJavaFileManager fm = new JavacFileManager(c, false, null);
jjg@56 47 fm.setLocation(StandardLocation.CLASS_PATH,
jjg@56 48 Arrays.asList(new File("DOES_NOT_EXIST.jar")));
jjg@56 49 FileObject fo = fm.getFileForInput(StandardLocation.CLASS_PATH,
jjg@56 50 "p", "C.java");
jjg@56 51 System.err.println(fo + "\n" + dc.getDiagnostics());
jjg@56 52 if (dc.getDiagnostics().size() > 0)
jjg@56 53 throw new Exception("unexpected diagnostics found");
jjg@56 54 }
jjg@58 55 }

mercurial