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