618N/A/*
618N/A * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
618N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
618N/A *
618N/A * This code is free software; you can redistribute it and/or modify it
618N/A * under the terms of the GNU General Public License version 2 only, as
618N/A * published by the Free Software Foundation.
618N/A *
618N/A * This code is distributed in the hope that it will be useful, but WITHOUT
618N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
618N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
618N/A * version 2 for more details (a copy is included in the LICENSE file that
618N/A * accompanied this code).
618N/A *
618N/A * You should have received a copy of the GNU General Public License version
618N/A * 2 along with this work; if not, write to the Free Software Foundation,
618N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
618N/A *
618N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
618N/A * or visit www.oracle.com if you need additional information or have any
618N/A * questions.
618N/A */
618N/A
618N/A/*
618N/A * @test 6403456
618N/A * @summary javax.tools.JavaCompilerTool.getStandardFileManager().list() includes directories
618N/A */
618N/A
618N/Aimport javax.tools.*;
618N/Aimport java.util.*;
618N/Aimport java.io.*;
618N/A
618N/Aimport static javax.tools.JavaFileObject.Kind;
618N/A
618N/Apublic class T6340549 {
618N/A public static void main(String... args) throws Exception {
618N/A
618N/A // Ensure a directory exists
618N/A File dir = new File("temp" + args.hashCode());
618N/A if (!dir.exists())
618N/A dir.mkdir();
618N/A if (!dir.isDirectory())
618N/A throw new AssertionError("Not a directory " + dir);
618N/A
618N/A try {
618N/A JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
618N/A StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
618N/A jfm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(".")));
618N/A
618N/A for (JavaFileObject jfo : jfm.list(StandardLocation.CLASS_PATH,
618N/A "", EnumSet.of(Kind.OTHER), false)) {
618N/A if (new File(jfo.getName()).isDirectory()) {
618N/A throw new AssertionError("Found directory: " + jfo);
618N/A }
618N/A }
618N/A } finally {
618N/A dir.delete(); // cleanup
618N/A }
618N/A }
618N/A}