Path: blob/aarch64-shenandoah-jdk8u272-b10/langtools/test/tools/javac/6257443/T6257443.java
38813 views
/*1* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223/**24* @test25* @bug 6257443 6350124 635797926* @summary compiler can produce a .class file in some source output modes27*28* @compile package-info.java29* @run main/othervm T6257443 -yes foo/package-info.class30*31* @clean foo.package-info32*33* @compile -XD-printflat package-info.java34* @run main/othervm T6257443 -no foo/package-info.class35*36* @compile -XD-stubs package-info.java37* @run main/othervm T6257443 -no foo/package-info.class38*39* @compile -XD-printsource package-info.java40* @run main/othervm T6257443 -no foo/package-info.class41*/4243import java.net.URL;4445public class T625744346{47public static void main(String[] args) {48if (args.length != 2)49throw new Error("wrong number of args");5051String state = args[0];52String file = args[1];5354if (state.equals("-no")) {55URL u = find(file);56if (u != null)57throw new Error("file " + file + " found unexpectedly");58}59else if (state.equals("-yes")) {60URL u = find(file);61if (u == null)62throw new Error("file " + file + " not found");63}64else65throw new Error("bad args");66}6768public static URL find(String path) {69return T6257443.class.getClassLoader().getSystemResource(path);70}71}727374