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