T6400303.java revision 3294:9adfb22ff08f
122347Spst/* 222347Spst * Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. 322347Spst * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 422347Spst * 522347Spst * This code is free software; you can redistribute it and/or modify it 622347Spst * under the terms of the GNU General Public License version 2 only, as 729964Sache * published by the Free Software Foundation. 892914Smarkm * 922347Spst * This code is distributed in the hope that it will be useful, but WITHOUT 1022347Spst * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1122347Spst * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1222347Spst * version 2 for more details (a copy is included in the LICENSE file that 1322347Spst * accompanied this code). 1422347Spst * 1522347Spst * You should have received a copy of the GNU General Public License version 1622347Spst * 2 along with this work; if not, write to the Free Software Foundation, 1722347Spst * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1822347Spst * 1922347Spst * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2022347Spst * or visit www.oracle.com if you need additional information or have any 2192914Smarkm * questions. 2229964Sache */ 2329964Sache 2429964Sache/** 2522347Spst * @test 2622347Spst * @bug 6400303 2722347Spst * @summary REGRESSION: javadoc crashes in b75 2822347Spst * @author Peter von der Ah\u00e9 2922347Spst * @modules jdk.compiler/com.sun.tools.javac.api 3022347Spst * jdk.compiler/com.sun.tools.javac.code 3122347Spst * jdk.compiler/com.sun.tools.javac.comp 3222347Spst * jdk.compiler/com.sun.tools.javac.main 3322347Spst * jdk.compiler/com.sun.tools.javac.util 3422347Spst * @compile Test1.java 3522347Spst * @compile Test2.java 3622347Spst * @run main/othervm -esa T6400303 3722347Spst */ 3822347Spst 3981596Sacheimport javax.tools.ToolProvider; 4081596Sache 4181596Sacheimport com.sun.tools.javac.api.JavacTaskImpl; 4222347Spstimport com.sun.tools.javac.code.Symbol.CompletionFailure; 4322347Spstimport com.sun.tools.javac.code.Symtab; 4422347Spstimport com.sun.tools.javac.comp.Modules; 4522347Spstimport com.sun.tools.javac.main.JavaCompiler; 4622347Spstimport com.sun.tools.javac.util.List; 4722347Spst 4822347Spstpublic class T6400303 { 4922347Spst public static void main(String... args) { 5022347Spst javax.tools.JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); 5122347Spst JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, null, null, null, null, null); 5222347Spst Symtab syms = Symtab.instance(task.getContext()); 5322347Spst //initialize unnamed module: 5422347Spst Modules.instance(task.getContext()).enter(List.nil(), syms.errSymbol); 5522347Spst JavaCompiler compiler = JavaCompiler.instance(task.getContext()); 5622347Spst try { 5722347Spst compiler.resolveIdent(syms.unnamedModule, "Test$1").complete(); 5822347Spst } catch (CompletionFailure ex) { 5922347Spst System.err.println("Got expected completion failure: " + ex.getLocalizedMessage()); 6022347Spst return; 6122347Spst } 6222347Spst throw new AssertionError("No error reported"); 6322347Spst } 6422347Spst} 6522347Spst