Path: blob/master/test/langtools/tools/javac/6589361/T6589361.java
41149 views
/*1* Copyright (c) 2016, 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 658936126* @summary 6589361:Failing building ct.sym file as part of the control build27* @modules jdk.compiler/com.sun.tools.javac.file28* jdk.compiler/com.sun.tools.javac.util29*/3031import com.sun.tools.javac.file.JavacFileManager;32import com.sun.tools.javac.util.Context;33import java.io.File;34import javax.tools.FileObject;35import javax.tools.JavaFileObject;36import javax.tools.JavaFileObject.Kind;37import javax.tools.StandardLocation;38import java.util.Set;39import java.util.HashSet;4041public class T6589361 {42public static void main(String [] args) throws Exception {43JavacFileManager fm = null;44try {45fm = new JavacFileManager(new Context(), false, null);46Set<JavaFileObject.Kind> set = new HashSet<JavaFileObject.Kind>();47set.add(JavaFileObject.Kind.CLASS);48Iterable<JavaFileObject> files = fm.list(StandardLocation.PLATFORM_CLASS_PATH, "java.lang", set, false);49for (JavaFileObject file : files) {50// Note: Zip/Jar entry names use '/', not File.separator, but just to be sure,51// we normalize the filename as well.52if (file.getName().replace(File.separatorChar, '/').contains("java/lang/Object.class")) {53String str = fm.inferBinaryName(StandardLocation.PLATFORM_CLASS_PATH, file);54if (!str.equals("java.lang.Object")) {55System.err.println("file object: " + file);56System.err.println(" class: " + file.getClass());57System.err.println(" name: " + file.getName());58System.err.println("binary name: " + str);59throw new AssertionError("Error in JavacFileManager.inferBinaryName method!");60}61else {62return;63}64}65}66}67finally {68if (fm != null) {69fm.close();70}71}72throw new AssertionError("Could not find java/lang/Object.class while compiling");73}7475}767778