Wed, 07 Nov 2012 17:20:12 -0800
8003134: CheckResourceKeys issues
Reviewed-by: jjh, bpatel
1 /*
2 * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
24 /**
25 * @test
26 * @bug 6257443 6350124 6357979
27 * @summary compiler can produce a .class file in some source output modes
28 *
29 * @compile package-info.java
30 * @run main/othervm T6257443 -yes foo/package-info.class
31 *
32 * @clean foo.package-info
33 *
34 * @compile -XD-printflat package-info.java
35 * @run main/othervm T6257443 -no foo/package-info.class
36 *
37 * @compile -XD-stubs package-info.java
38 * @run main/othervm T6257443 -no foo/package-info.class
39 *
40 * @compile -XD-printsource package-info.java
41 * @run main/othervm T6257443 -no foo/package-info.class
42 */
44 import java.net.URL;
46 public class T6257443
47 {
48 public static void main(String[] args) {
49 if (args.length != 2)
50 throw new Error("wrong number of args");
52 String state = args[0];
53 String file = args[1];
55 if (state.equals("-no")) {
56 URL u = find(file);
57 if (u != null)
58 throw new Error("file " + file + " found unexpectedly");
59 }
60 else if (state.equals("-yes")) {
61 URL u = find(file);
62 if (u == null)
63 throw new Error("file " + file + " not found");
64 }
65 else
66 throw new Error("bad args");
67 }
69 public static URL find(String path) {
70 return T6257443.class.getClassLoader().getSystemResource(path);
71 }
72 }