677N/A/*
677N/A * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
677N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
677N/A *
677N/A * This code is free software; you can redistribute it and/or modify it
677N/A * under the terms of the GNU General Public License version 2 only, as
677N/A * published by the Free Software Foundation.
677N/A *
677N/A * This code is distributed in the hope that it will be useful, but WITHOUT
677N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
677N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
677N/A * version 2 for more details (a copy is included in the LICENSE file that
677N/A * accompanied this code).
677N/A *
677N/A * You should have received a copy of the GNU General Public License version
677N/A * 2 along with this work; if not, write to the Free Software Foundation,
677N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
677N/A *
677N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
677N/A * or visit www.oracle.com if you need additional information or have any
677N/A * questions.
677N/A */
677N/A
677N/A/*
677N/A * @test
677N/A * @bug 6900149
677N/A * @summary IllegalStateException when compiling same files and DiagnosticListener is set
677N/A */
677N/A
677N/Aimport java.io.*;
677N/Aimport java.util.*;
677N/Aimport javax.tools.*;
677N/Aimport javax.tools.JavaCompiler.CompilationTask;
677N/A
677N/Apublic class T6900149 {
677N/A public static void main(String[] args) throws IOException {
677N/A DiagnosticCollector<JavaFileObject> diag =
677N/A new DiagnosticCollector<JavaFileObject>();
677N/A JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
677N/A StandardJavaFileManager fm =
677N/A compiler.getStandardFileManager(null, null, null);
677N/A File emptyFile = File.createTempFile("Empty", ".java");
677N/A File[] files = new File[] { emptyFile, emptyFile };
677N/A CompilationTask task = compiler.getTask(null, fm, diag,
677N/A null, null, fm.getJavaFileObjects(files));
677N/A if (! task.call()) {
677N/A throw new AssertionError("compilation failed");
677N/A }
677N/A }
677N/A}