99N/A/*
1451N/A * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
99N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
99N/A *
99N/A * This code is free software; you can redistribute it and/or modify it
99N/A * under the terms of the GNU General Public License version 2 only, as
99N/A * published by the Free Software Foundation.
99N/A *
99N/A * This code is distributed in the hope that it will be useful, but WITHOUT
99N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
99N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
99N/A * version 2 for more details (a copy is included in the LICENSE file that
99N/A * accompanied this code).
99N/A *
99N/A * You should have received a copy of the GNU General Public License version
99N/A * 2 along with this work; if not, write to the Free Software Foundation,
99N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
99N/A *
553N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
553N/A * or visit www.oracle.com if you need additional information or have any
553N/A * questions.
99N/A */
99N/A
99N/A/*
99N/A * @test
99N/A * @bug 6733837
99N/A * @summary Compiler API ignores locale settings
99N/A * @author Maurizio Cimadamore
99N/A * @library ../lib
1451N/A * @build ToolTester
1451N/A * @run main T6733837
99N/A */
99N/A
99N/Aimport java.io.StringWriter;
99N/Aimport java.io.PrintWriter;
99N/Aimport java.net.URI;
99N/Aimport java.util.Arrays;
99N/Aimport java.util.List;
99N/Aimport javax.tools.JavaFileObject;
99N/Aimport javax.tools.SimpleJavaFileObject;
99N/Aimport static javax.tools.JavaFileObject.Kind;
99N/Aimport com.sun.source.util.JavacTask;
99N/A
99N/Apublic class T6733837 extends ToolTester {
99N/A
99N/A public static void main(String... args) {
99N/A new T6733837().exec();
99N/A }
99N/A
99N/A public void exec() {
414N/A JavaFileObject sfo = new SimpleJavaFileObject(URI.create("myfo:/Test.java"),Kind.SOURCE) {
99N/A public CharSequence getCharContent(boolean ignoreEncodingErrors) {
99N/A return "\tclass ErroneousWithTab";
99N/A }
99N/A };
99N/A StringWriter sw = new StringWriter();
99N/A PrintWriter out = new PrintWriter(sw);
99N/A List<? extends JavaFileObject> files = Arrays.asList(sfo);
99N/A task = tool.getTask(sw, fm, null, null, null, files);
99N/A try {
99N/A ((JavacTask)task).analyze();
99N/A }
99N/A catch (Throwable t) {
99N/A throw new Error("Compiler threw an exception");
99N/A }
99N/A System.err.println(sw.toString());
414N/A if (!sw.toString().contains("/Test.java"))
99N/A throw new Error("Bad source name in diagnostic");
99N/A }
99N/A}