test/tools/javac/api/6608214/T6608214.java

Mon, 06 Sep 2010 12:55:09 -0700

author
jjg
date
Mon, 06 Sep 2010 12:55:09 -0700
changeset 672
ea54372637a5
parent 554
9d9f26857129
child 2525
2eb010b6cb22
permissions
-rw-r--r--

6930507: Symbols for anonymous and local classes made too late for use by java tree API
Reviewed-by: mcimadamore

mcimadamore@7 1 /*
ohair@554 2 * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
mcimadamore@7 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
mcimadamore@7 4 *
mcimadamore@7 5 * This code is free software; you can redistribute it and/or modify it
mcimadamore@7 6 * under the terms of the GNU General Public License version 2 only, as
mcimadamore@7 7 * published by the Free Software Foundation.
mcimadamore@7 8 *
mcimadamore@7 9 * This code is distributed in the hope that it will be useful, but WITHOUT
mcimadamore@7 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
mcimadamore@7 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mcimadamore@7 12 * version 2 for more details (a copy is included in the LICENSE file that
mcimadamore@7 13 * accompanied this code).
mcimadamore@7 14 *
mcimadamore@7 15 * You should have received a copy of the GNU General Public License version
mcimadamore@7 16 * 2 along with this work; if not, write to the Free Software Foundation,
mcimadamore@7 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
mcimadamore@7 18 *
ohair@554 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
ohair@554 20 * or visit www.oracle.com if you need additional information or have any
ohair@554 21 * questions.
mcimadamore@7 22 */
mcimadamore@7 23
mcimadamore@7 24 /*
mcimadamore@7 25 * @test
mcimadamore@7 26 * @bug 6608214
mcimadamore@7 27 * @summary Exception throw while analysing a file with error
mcimadamore@7 28 * @author Maurizio Cimadamore
mcimadamore@7 29 */
mcimadamore@7 30
mcimadamore@7 31 import com.sun.source.util.JavacTask;
mcimadamore@7 32 import java.io.IOException;
mcimadamore@7 33 import java.net.URI;
mcimadamore@7 34 import java.util.Arrays;
mcimadamore@7 35 import java.util.List;
mcimadamore@7 36 import javax.tools.JavaCompiler;
mcimadamore@7 37 import javax.tools.JavaFileObject;
mcimadamore@7 38 import javax.tools.SimpleJavaFileObject;
mcimadamore@7 39 import javax.tools.ToolProvider;
mcimadamore@7 40 import static javax.tools.JavaFileObject.Kind;
mcimadamore@7 41
mcimadamore@7 42 public class T6608214 {
mcimadamore@7 43 public static void main(String[] args) throws IOException {
mcimadamore@7 44 JavaFileObject sfo = new SimpleJavaFileObject(URI.create(""),Kind.SOURCE) {
mcimadamore@7 45 public CharSequence getCharContent(boolean ignoreEncodingErrors) {
mcimadamore@7 46 return "class Test<S> { <T extends S & Runnable> void test(){}}";
mcimadamore@7 47 }
mcimadamore@7 48 };
mcimadamore@7 49 List<? extends JavaFileObject> files = Arrays.asList(sfo);
mcimadamore@7 50 String bootPath = System.getProperty("sun.boot.class.path");
mcimadamore@7 51 List<String> opts = Arrays.asList("-bootclasspath", bootPath, "-Xjcov");
mcimadamore@7 52 JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
mcimadamore@7 53 JavacTask ct = (JavacTask)tool.getTask(null, null, null,opts,null,files);
mcimadamore@7 54 ct.analyze();
mcimadamore@7 55 }
mcimadamore@7 56 }

mercurial