mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-17 09:34:38 +02:00
8062348: langtools tests should close file manager (group 1)
Reviewed-by: darcy
This commit is contained in:
parent
b587478f7c
commit
8bd23f1681
145 changed files with 2701 additions and 2452 deletions
|
@ -77,7 +77,7 @@ public class RunCodingRules {
|
||||||
}
|
}
|
||||||
|
|
||||||
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = javaCompiler.getStandardFileManager(null, null, null)) {
|
||||||
DiagnosticListener<JavaFileObject> noErrors = diagnostic -> {
|
DiagnosticListener<JavaFileObject> noErrors = diagnostic -> {
|
||||||
Assert.check(diagnostic.getKind() != Diagnostic.Kind.ERROR, diagnostic.toString());
|
Assert.check(diagnostic.getKind() != Diagnostic.Kind.ERROR, diagnostic.toString());
|
||||||
};
|
};
|
||||||
|
@ -113,6 +113,7 @@ public class RunCodingRules {
|
||||||
javaCompiler.getTask(null, fm, noErrors, options, null,
|
javaCompiler.getTask(null, fm, noErrors, options, null,
|
||||||
fm.getJavaFileObjectsFromFiles(sources)).call();
|
fm.getJavaFileObjectsFromFiles(sources)).call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Stream<Path> silentFilesWalk(Path dir) throws IllegalStateException {
|
Stream<Path> silentFilesWalk(Path dir) throws IllegalStateException {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -113,7 +113,7 @@ public class T6341866 {
|
||||||
|
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
MyDiagListener dl = new MyDiagListener();
|
MyDiagListener dl = new MyDiagListener();
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null)) {
|
||||||
|
|
||||||
// Note: class A references class B, so compile A if we want implicit compilation
|
// Note: class A references class B, so compile A if we want implicit compilation
|
||||||
File file = (implicitType != ImplicitType.NONE) ? a_java : b_java;
|
File file = (implicitType != ImplicitType.NONE) ? a_java : b_java;
|
||||||
|
@ -166,6 +166,7 @@ public class T6341866 {
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void createProcessorServices(String name) throws IOException {
|
static void createProcessorServices(String name) throws IOException {
|
||||||
processorServices.getParentFile().mkdirs();
|
processorServices.getParentFile().mkdirs();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -58,8 +58,7 @@ public class T6400872 {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
System.err.println("compile...");
|
System.err.println("compile...");
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
try {
|
|
||||||
Iterable<? extends JavaFileObject> fileObjects =
|
Iterable<? extends JavaFileObject> fileObjects =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(files));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(files));
|
||||||
|
|
||||||
|
@ -78,8 +77,6 @@ public class T6400872 {
|
||||||
compiler.getTask(null, fm, null, options, null, fileObjects);
|
compiler.getTask(null, fm, null, options, null, fileObjects);
|
||||||
if (!task.call())
|
if (!task.call())
|
||||||
throw new AssertionError("compilation failed");
|
throw new AssertionError("compilation failed");
|
||||||
} finally {
|
|
||||||
fm.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ abstract class Checker {
|
||||||
};
|
};
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(getFiles(testSrc, fileNames));
|
fm.getJavaFileObjectsFromFiles(getFiles(testSrc, fileNames));
|
||||||
task = tool.getTask(null, fm, dl, null, null, files);
|
task = tool.getTask(null, fm, dl, null, null, files);
|
||||||
|
@ -74,6 +74,7 @@ abstract class Checker {
|
||||||
if (errors)
|
if (errors)
|
||||||
throw new AssertionError("errors occurred checking scopes");
|
throw new AssertionError("errors occurred checking scopes");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// default impl: split ref at ";" and call checkLocal(scope, ref_segment) on scope and its enclosing scopes
|
// default impl: split ref at ";" and call checkLocal(scope, ref_segment) on scope and its enclosing scopes
|
||||||
protected boolean check(Scope s, String ref) {
|
protected boolean check(Scope s, String ref) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -40,7 +40,7 @@ public class T6440583 {
|
||||||
String testSrc = System.getProperty("test.src", ".");
|
String testSrc = System.getProperty("test.src", ".");
|
||||||
String testClasses = System.getProperty("test.classes", ".");
|
String testClasses = System.getProperty("test.classes", ".");
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "A.java")));
|
||||||
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
||||||
|
@ -65,6 +65,7 @@ public class T6440583 {
|
||||||
if (!found)
|
if (!found)
|
||||||
throw new AssertionError("no ErroneousTree nodes found");
|
throw new AssertionError("no ErroneousTree nodes found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean found;
|
private static boolean found;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -54,7 +54,7 @@ public class Test {
|
||||||
|
|
||||||
void test(File test) throws Exception {
|
void test(File test) throws Exception {
|
||||||
JavacTool tool1 = JavacTool.create();
|
JavacTool tool1 = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool1.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool1.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(test);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(test);
|
||||||
|
|
||||||
// parse test file into a tree, and write it out to a stringbuffer using Pretty
|
// parse test file into a tree, and write it out to a stringbuffer using Pretty
|
||||||
|
@ -87,5 +87,6 @@ public class Test {
|
||||||
if (!expectedClass.exists())
|
if (!expectedClass.exists())
|
||||||
throw new Exception(expectedClass + " not found");
|
throw new Exception(expectedClass + " not found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -49,9 +49,6 @@ public class T7003595 {
|
||||||
|
|
||||||
/** global decls ***/
|
/** global decls ***/
|
||||||
|
|
||||||
// Create a single file manager and reuse it for each compile to save time.
|
|
||||||
static StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
|
|
||||||
|
|
||||||
//statistics
|
//statistics
|
||||||
static int checkCount = 0;
|
static int checkCount = 0;
|
||||||
|
|
||||||
|
@ -112,6 +109,8 @@ public class T7003595 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
// Create a single file manager and reuse it for each compile to save time.
|
||||||
|
try (StandardJavaFileManager fm = JavacTool.create().getStandardFileManager(null, null, null)) {
|
||||||
for (ClassKind ck1 : ClassKind.values()) {
|
for (ClassKind ck1 : ClassKind.values()) {
|
||||||
String cname1 = "C1";
|
String cname1 = "C1";
|
||||||
for (ClassKind ck2 : ClassKind.values()) {
|
for (ClassKind ck2 : ClassKind.values()) {
|
||||||
|
@ -120,7 +119,8 @@ public class T7003595 {
|
||||||
for (ClassKind ck3 : ClassKind.values()) {
|
for (ClassKind ck3 : ClassKind.values()) {
|
||||||
if (!ck2.isAllowed(ck3)) continue;
|
if (!ck2.isAllowed(ck3)) continue;
|
||||||
String cname3 = "C3";
|
String cname3 = "C3";
|
||||||
new T7003595(new ClassKind[] {ck1, ck2, ck3}, new String[] { cname1, cname2, cname3 }).compileAndCheck();
|
new T7003595(fm, new ClassKind[] {ck1, ck2, ck3}, new String[] { cname1, cname2, cname3 }).compileAndCheck();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -132,8 +132,10 @@ public class T7003595 {
|
||||||
|
|
||||||
ClassKind[] cks;
|
ClassKind[] cks;
|
||||||
String[] cnames;
|
String[] cnames;
|
||||||
|
StandardJavaFileManager fm;
|
||||||
|
|
||||||
T7003595(ClassKind[] cks, String[] cnames) {
|
T7003595(StandardJavaFileManager fm, ClassKind[] cks, String[] cnames) {
|
||||||
|
this.fm = fm;
|
||||||
this.cks = cks;
|
this.cks = cks;
|
||||||
this.cnames = cnames;
|
this.cnames = cnames;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -100,7 +100,7 @@ public class TestCircularClassfile {
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (SourceKind sk1 : SourceKind.values()) {
|
for (SourceKind sk1 : SourceKind.values()) {
|
||||||
for (SourceKind sk2 : SourceKind.values()) {
|
for (SourceKind sk2 : SourceKind.values()) {
|
||||||
|
@ -112,6 +112,7 @@ public class TestCircularClassfile {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static String workDir = System.getProperty("user.dir");
|
static String workDir = System.getProperty("user.dir");
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -96,11 +96,12 @@ public class T7142086 {
|
||||||
void run(List<JavaFileObject> sources) throws Exception {
|
void run(List<JavaFileObject> sources) throws Exception {
|
||||||
DiagnosticChecker dc = new DiagnosticChecker();
|
DiagnosticChecker dc = new DiagnosticChecker();
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
JavacTask ct = (JavacTask)comp.getTask(null, fm, dc,
|
JavacTask ct = (JavacTask)comp.getTask(null, fm, dc,
|
||||||
null, null, sources);
|
null, null, sources);
|
||||||
ct.analyze();
|
ct.analyze();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
|
static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -54,7 +54,7 @@ public class NoStringToLower {
|
||||||
*/
|
*/
|
||||||
boolean run(String... args) throws Exception {
|
boolean run(String... args) throws Exception {
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
JavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (JavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
JavaFileManager.Location javacLoc = findJavacLocation(fm);
|
JavaFileManager.Location javacLoc = findJavacLocation(fm);
|
||||||
String[] pkgs = {
|
String[] pkgs = {
|
||||||
"javax.annotation.processing",
|
"javax.annotation.processing",
|
||||||
|
@ -80,6 +80,7 @@ public class NoStringToLower {
|
||||||
|
|
||||||
return (errors == 0);
|
return (errors == 0);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// depending on how the test is run, javac may be on bootclasspath or classpath
|
// depending on how the test is run, javac may be on bootclasspath or classpath
|
||||||
JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
|
JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -71,10 +71,10 @@ public class JarFromManifestFailure {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compile(File classOutDir, Iterable<File> classPath, File... files) {
|
static void compile(File classOutDir, Iterable<File> classPath, File... files) throws IOException {
|
||||||
System.err.println("compile...");
|
System.err.println("compile...");
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> fileObjects =
|
Iterable<? extends JavaFileObject> fileObjects =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(files));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(files));
|
||||||
|
|
||||||
|
@ -94,6 +94,7 @@ public class JarFromManifestFailure {
|
||||||
if (!task.call())
|
if (!task.call())
|
||||||
throw new AssertionError("compilation failed");
|
throw new AssertionError("compilation failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void jar(File jar, Iterable<File> classPath, File base, File... files)
|
static void jar(File jar, Iterable<File> classPath, File base, File... files)
|
||||||
throws IOException {
|
throws IOException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -116,7 +116,7 @@ public class TestCompileJARInClassPath {
|
||||||
|
|
||||||
javax.tools.JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
javax.tools.JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
|
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
|
||||||
StandardJavaFileManager stdFileManager = javac.getStandardFileManager(diagnostics, null, null);
|
try (StandardJavaFileManager stdFileManager = javac.getStandardFileManager(diagnostics, null, null)) {
|
||||||
|
|
||||||
List<File> files = new ArrayList<>();
|
List<File> files = new ArrayList<>();
|
||||||
files.add(clientJarFile);
|
files.add(clientJarFile);
|
||||||
|
@ -129,4 +129,5 @@ public class TestCompileJARInClassPath {
|
||||||
throw new AssertionError("compilation failed");
|
throw new AssertionError("compilation failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,11 +44,12 @@ public class T6265400 {
|
||||||
throw new NullPointerException(SILLY_BILLY);
|
throw new NullPointerException(SILLY_BILLY);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromStrings(Arrays.asList("badfile.java"));
|
fm.getJavaFileObjectsFromStrings(Arrays.asList("badfile.java"));
|
||||||
javac.getTask(null, fm, dl, null, null, files).call();
|
javac.getTask(null, fm, dl, null, null, files).call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
Throwable cause = e.getCause();
|
Throwable cause = e.getCause();
|
||||||
if (cause instanceof NullPointerException
|
if (cause instanceof NullPointerException
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,7 +44,7 @@ public class T6340549 {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
jfm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(".")));
|
jfm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(new File(".")));
|
||||||
|
|
||||||
for (JavaFileObject jfo : jfm.list(StandardLocation.CLASS_PATH,
|
for (JavaFileObject jfo : jfm.list(StandardLocation.CLASS_PATH,
|
||||||
|
@ -53,6 +53,7 @@ public class T6340549 {
|
||||||
throw new AssertionError("Found directory: " + jfo);
|
throw new AssertionError("Found directory: " + jfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} finally {
|
} finally {
|
||||||
dir.delete(); // cleanup
|
dir.delete(); // cleanup
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,7 +38,7 @@ public class T6351767 {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
JavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
|
try (JavaFileManager jfm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
// test null
|
// test null
|
||||||
try {
|
try {
|
||||||
|
@ -83,7 +83,7 @@ public class T6351767 {
|
||||||
}
|
}
|
||||||
if (!found)
|
if (!found)
|
||||||
error("expected file, java/lang/Object.class, not found");
|
error("expected file, java/lang/Object.class, not found");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void error(String msg) {
|
static void error(String msg) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -57,7 +57,7 @@ public class T6361619 extends AbstractProcessor {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> f =
|
Iterable<? extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir,
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir,
|
||||||
self + ".java")));
|
self + ".java")));
|
||||||
|
@ -69,6 +69,7 @@ public class T6361619 extends AbstractProcessor {
|
||||||
// should complete, without exceptions
|
// should complete, without exceptions
|
||||||
task.call();
|
task.call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
|
public boolean process(Set<? extends TypeElement> elems, RoundEnvironment renv) {
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class T6395974 {
|
||||||
String testSrc = System.getProperty("test.src");
|
String testSrc = System.getProperty("test.src");
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<?extends JavaFileObject> f =
|
Iterable<?extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self + ".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self + ".java")));
|
||||||
|
|
||||||
|
@ -63,6 +63,7 @@ public class T6395974 {
|
||||||
|
|
||||||
task.call();
|
task.call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static class MyTaskListener implements TaskListener {
|
static class MyTaskListener implements TaskListener {
|
||||||
public void started(TaskEvent e) {
|
public void started(TaskEvent e) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,7 +42,7 @@ public abstract class T6397044 {
|
||||||
String srcDir = System.getProperty("test.src", ".");
|
String srcDir = System.getProperty("test.src", ".");
|
||||||
String self = T6397044.class.getName();
|
String self = T6397044.class.getName();
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files
|
Iterable<? extends JavaFileObject> files
|
||||||
= fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcDir, self + ".java")));
|
= fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcDir, self + ".java")));
|
||||||
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
||||||
|
@ -51,6 +51,7 @@ public abstract class T6397044 {
|
||||||
for (CompilationUnitTree tree: trees)
|
for (CompilationUnitTree tree: trees)
|
||||||
checker.check(tree);
|
checker.check(tree);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public int x_public;
|
public int x_public;
|
||||||
protected int x_protected;
|
protected int x_protected;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -40,7 +40,7 @@ public class T6397286 {
|
||||||
String self = T6397286.class.getName();
|
String self = T6397286.class.getName();
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ public class T6397286 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class TaskEventError extends Error {
|
class TaskEventError extends Error {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -51,7 +51,7 @@ public class T6403466 extends AbstractProcessor {
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
|
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
||||||
|
|
||||||
|
@ -70,6 +70,7 @@ public class T6403466 extends AbstractProcessor {
|
||||||
if (vtl.iter.hasNext() || vtl.errors)
|
if (vtl.iter.hasNext() || vtl.errors)
|
||||||
throw new AssertionError("comparison against golden file failed.");
|
throw new AssertionError("comparison against golden file failed.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) {
|
public boolean process(Set<? extends TypeElement> annos, RoundEnvironment rEnv) {
|
||||||
if (!rEnv.processingOver()) {
|
if (!rEnv.processingOver()) {
|
||||||
|
|
|
@ -33,13 +33,13 @@ public class T6406771 extends AbstractProcessor {
|
||||||
|
|
||||||
// White-space after this point does not matter
|
// White-space after this point does not matter
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) throws IOException {
|
||||||
String self = T6406771.class.getName();
|
String self = T6406771.class.getName();
|
||||||
String testSrc = System.getProperty("test.src");
|
String testSrc = System.getProperty("test.src");
|
||||||
String testClasses = System.getProperty("test.classes");
|
String testClasses = System.getProperty("test.classes");
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
JavaFileObject f = fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self+".java"))).iterator().next();
|
JavaFileObject f = fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, self+".java"))).iterator().next();
|
||||||
|
|
||||||
List<String> opts = Arrays.asList("-d", ".", "-processorpath", testClasses, "-processor", self, "-proc:only");
|
List<String> opts = Arrays.asList("-d", ".", "-processorpath", testClasses, "-processor", self, "-proc:only");
|
||||||
|
@ -49,6 +49,7 @@ public class T6406771 extends AbstractProcessor {
|
||||||
if (!task.call())
|
if (!task.call())
|
||||||
throw new AssertionError("failed");
|
throw new AssertionError("failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean process(Set<? extends TypeElement> elems, RoundEnvironment rEnv) {
|
public boolean process(Set<? extends TypeElement> elems, RoundEnvironment rEnv) {
|
||||||
final String LINE = "line" + ':'; // avoid matching this string
|
final String LINE = "line" + ':'; // avoid matching this string
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,7 +37,7 @@ public class T6407066 {
|
||||||
String testClasses = System.getProperty("test.classes", ".");
|
String testClasses = System.getProperty("test.classes", ".");
|
||||||
|
|
||||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager jfm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager jfm = tool.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
List<File> path = new ArrayList<File>();
|
List<File> path = new ArrayList<File>();
|
||||||
path.add(new File("BadDirectory"));
|
path.add(new File("BadDirectory"));
|
||||||
|
@ -53,4 +53,5 @@ public class T6407066 {
|
||||||
if (!path.equals(path2))
|
if (!path.equals(path2))
|
||||||
throw new AssertionError("path not preserved");
|
throw new AssertionError("path not preserved");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,7 +44,7 @@ public class T6410706 {
|
||||||
String testClasses = System.getProperty("test.classes", ".");
|
String testClasses = System.getProperty("test.classes", ".");
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
MyDiagListener dl = new MyDiagListener();
|
MyDiagListener dl = new MyDiagListener();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null)) {
|
||||||
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(testClasses)));
|
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(testClasses)));
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6410706.class.getName()+".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6410706.class.getName()+".java")));
|
||||||
|
@ -60,6 +60,7 @@ public class T6410706 {
|
||||||
if (dl.notes != 2)
|
if (dl.notes != 2)
|
||||||
throw new AssertionError(dl.notes + " notes given");
|
throw new AssertionError(dl.notes + " notes given");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class MyDiagListener implements DiagnosticListener<JavaFileObject>
|
private static class MyDiagListener implements DiagnosticListener<JavaFileObject>
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -55,7 +55,7 @@ public class T6458823 {
|
||||||
}
|
}
|
||||||
DiagnosticCollector<JavaFileObject> diagColl =
|
DiagnosticCollector<JavaFileObject> diagColl =
|
||||||
new DiagnosticCollector<JavaFileObject>();
|
new DiagnosticCollector<JavaFileObject>();
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
List<String> options = new ArrayList<String>();
|
List<String> options = new ArrayList<String>();
|
||||||
options.add("-processor");
|
options.add("-processor");
|
||||||
options.add("MyProcessor");
|
options.add("MyProcessor");
|
||||||
|
@ -84,4 +84,5 @@ public class T6458823 {
|
||||||
diagCount + ", expected: 2");
|
diagCount + ", expected: 2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -47,8 +47,8 @@ public class T6665791 {
|
||||||
write(test_java, test);
|
write(test_java, test);
|
||||||
|
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager manager =
|
try (StandardJavaFileManager manager =
|
||||||
compiler.getStandardFileManager(null, null, null);
|
compiler.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> units = manager.getJavaFileObjects(test_java);
|
Iterable<? extends JavaFileObject> units = manager.getJavaFileObjects(test_java);
|
||||||
final StringWriter sw = new StringWriter();
|
final StringWriter sw = new StringWriter();
|
||||||
JavacTask task = (JavacTask) compiler.getTask(sw, manager, null, null,
|
JavacTask task = (JavacTask) compiler.getTask(sw, manager, null, null,
|
||||||
|
@ -72,6 +72,7 @@ public class T6665791 {
|
||||||
throw new Exception("unexpected output");
|
throw new Exception("unexpected output");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void write(File file, String body) throws IOException {
|
static void write(File file, String body) throws IOException {
|
||||||
FileWriter out = new FileWriter(file);
|
FileWriter out = new FileWriter(file);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -45,7 +45,7 @@ public class T6705935 {
|
||||||
java_home = java_home.getParentFile();
|
java_home = java_home.getParentFile();
|
||||||
|
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
//System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));
|
//System.err.println("platform class path: " + asList(fm.getLocation(StandardLocation.PLATFORM_CLASS_PATH)));
|
||||||
|
|
||||||
for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
|
for (JavaFileObject fo: fm.list(StandardLocation.PLATFORM_CLASS_PATH,
|
||||||
|
@ -86,6 +86,7 @@ public class T6705935 {
|
||||||
if (test == skip)
|
if (test == skip)
|
||||||
System.out.println("Warning: all files skipped; no platform classes found in zip files.");
|
System.out.println("Warning: all files skipped; no platform classes found in zip files.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private <T> List<T> asList(Iterable<? extends T> items) {
|
private <T> List<T> asList(Iterable<? extends T> items) {
|
||||||
List<T> list = new ArrayList<T>();
|
List<T> list = new ArrayList<T>();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -37,8 +37,8 @@ public class T6900149 {
|
||||||
DiagnosticCollector<JavaFileObject> diag =
|
DiagnosticCollector<JavaFileObject> diag =
|
||||||
new DiagnosticCollector<JavaFileObject>();
|
new DiagnosticCollector<JavaFileObject>();
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm =
|
try (StandardJavaFileManager fm =
|
||||||
compiler.getStandardFileManager(null, null, null);
|
compiler.getStandardFileManager(null, null, null)) {
|
||||||
File emptyFile = createTempFile("Empty.java");
|
File emptyFile = createTempFile("Empty.java");
|
||||||
File[] files = new File[] { emptyFile, emptyFile };
|
File[] files = new File[] { emptyFile, emptyFile };
|
||||||
CompilationTask task = compiler.getTask(null, fm, diag,
|
CompilationTask task = compiler.getTask(null, fm, diag,
|
||||||
|
@ -47,6 +47,7 @@ public class T6900149 {
|
||||||
throw new AssertionError("compilation failed");
|
throw new AssertionError("compilation failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static File createTempFile(String path) throws IOException {
|
private static File createTempFile(String path) throws IOException {
|
||||||
File f = new File(path);
|
File f = new File(path);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,7 +44,7 @@ public class T6956462 {
|
||||||
if (compiler == null) {
|
if (compiler == null) {
|
||||||
throw new RuntimeException("can't get javax.tools.JavaCompiler!");
|
throw new RuntimeException("can't get javax.tools.JavaCompiler!");
|
||||||
}
|
}
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
List<File> files = new ArrayList<File>();
|
List<File> files = new ArrayList<File>();
|
||||||
files.add(new File(T6956462.class.getResource("TestClass.java").toURI()));
|
files.add(new File(T6956462.class.getResource("TestClass.java").toURI()));
|
||||||
final CompilationTask task = compiler.getTask(null, fm, null,
|
final CompilationTask task = compiler.getTask(null, fm, null,
|
||||||
|
@ -54,6 +54,7 @@ public class T6956462 {
|
||||||
cu.accept(new MyVisitor(javacTask), null);
|
cu.accept(new MyVisitor(javacTask), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class MyVisitor extends SimpleTreeVisitor<Tree, Void> {
|
private static class MyVisitor extends SimpleTreeVisitor<Tree, Void> {
|
||||||
private final Trees trees;
|
private final Trees trees;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -96,7 +96,7 @@ public class T6956638 {
|
||||||
List<String> compileOptions = Arrays.asList("-d", classesDir.getPath());
|
List<String> compileOptions = Arrays.asList("-d", classesDir.getPath());
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
|
DiagnosticCollector<JavaFileObject> diagnosticCollector = new DiagnosticCollector<JavaFileObject>();
|
||||||
StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnosticCollector, null, null);
|
try (StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnosticCollector, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> sourceFileObjects = fileManager.getJavaFileObjects(sourceFiles);
|
Iterable<? extends JavaFileObject> sourceFileObjects = fileManager.getJavaFileObjects(sourceFiles);
|
||||||
System.err.println("1- javac given java source JavaFileObjects " + sourceFileObjects);
|
System.err.println("1- javac given java source JavaFileObjects " + sourceFileObjects);
|
||||||
JavaCompiler.CompilationTask task = compiler.getTask(compilerOutputStream, fileManager, null, compileOptions, null, sourceFileObjects);
|
JavaCompiler.CompilationTask task = compiler.getTask(compilerOutputStream, fileManager, null, compileOptions, null, sourceFileObjects);
|
||||||
|
@ -126,6 +126,7 @@ public class T6956638 {
|
||||||
+ " expected: " + size(parsedTrees));
|
+ " expected: " + size(parsedTrees));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void error(Throwable t) {
|
private void error(Throwable t) {
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -58,7 +58,7 @@ public class Bug {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StandardJavaFileManager sjfm = javac.getStandardFileManager(dl,null,null);
|
try (StandardJavaFileManager sjfm = javac.getStandardFileManager(dl,null,null)) {
|
||||||
|
|
||||||
List<String> opts = new ArrayList<String>();
|
List<String> opts = new ArrayList<String>();
|
||||||
opts.add("-proc:only");
|
opts.add("-proc:only");
|
||||||
|
@ -82,4 +82,5 @@ public class Bug {
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -45,6 +45,7 @@ import javax.lang.model.SourceVersion;
|
||||||
import javax.lang.model.element.TypeElement;
|
import javax.lang.model.element.TypeElement;
|
||||||
import javax.tools.Diagnostic;
|
import javax.tools.Diagnostic;
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
|
import javax.tools.StandardJavaFileManager;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
public class T7159016 {
|
public class T7159016 {
|
||||||
|
@ -58,13 +59,15 @@ public class T7159016 {
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
|
||||||
JavaCompiler.CompilationTask task = jc.getTask(null, null, null, null, null,
|
try (StandardJavaFileManager fm = jc.getStandardFileManager(null, null, null)) {
|
||||||
jc.getStandardFileManager(null, null, null).getJavaFileObjects(src));
|
JavaCompiler.CompilationTask task = jc.getTask(null, fm, null, null, null,
|
||||||
|
fm.getJavaFileObjects(src));
|
||||||
task.setProcessors(Collections.singleton(new Proc()));
|
task.setProcessors(Collections.singleton(new Proc()));
|
||||||
if (!task.call()) {
|
if (!task.call()) {
|
||||||
throw new Error("Test failed");
|
throw new Error("Test failed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class Proc extends JavacTestingAbstractProcessor {
|
private static class Proc extends JavacTestingAbstractProcessor {
|
||||||
int written;
|
int written;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -179,7 +179,7 @@ public class DetectMutableStaticFields {
|
||||||
ConstantPoolException,
|
ConstantPoolException,
|
||||||
InvalidDescriptor {
|
InvalidDescriptor {
|
||||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
JavaFileManager.Location location =
|
JavaFileManager.Location location =
|
||||||
StandardLocation.locationFor(resource.getPath());
|
StandardLocation.locationFor(resource.getPath());
|
||||||
fm.setLocation(location, com.sun.tools.javac.util.List.of(
|
fm.setLocation(location, com.sun.tools.javac.util.List.of(
|
||||||
|
@ -194,6 +194,7 @@ public class DetectMutableStaticFields {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> currentFieldsToIgnore;
|
List<String> currentFieldsToIgnore;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -132,7 +132,7 @@ public class ParameterNamesAreNotCopiedToAnonymousInitTest {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Assert.checkNonNull(paramsToCheck, nonNullParamPositionsMsg);
|
Assert.checkNonNull(paramsToCheck, nonNullParamPositionsMsg);
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> fos =
|
Iterable<? extends JavaFileObject> fos =
|
||||||
fm.getJavaFileObjectsFromFiles(
|
fm.getJavaFileObjectsFromFiles(
|
||||||
Arrays.asList(new File(System.getProperty("test.src"),
|
Arrays.asList(new File(System.getProperty("test.src"),
|
||||||
|
@ -201,6 +201,7 @@ public class ParameterNamesAreNotCopiedToAnonymousInitTest {
|
||||||
error(compilationFailed);
|
error(compilationFailed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void error(String msg) {
|
void error(String msg) {
|
||||||
throw new AssertionError(msg);
|
throw new AssertionError(msg);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -117,7 +117,7 @@ public class InterruptedExceptionTest {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (XlintOption xlint : XlintOption.values()) {
|
for (XlintOption xlint : XlintOption.values()) {
|
||||||
for (SuppressLevel suppress_decl : SuppressLevel.values()) {
|
for (SuppressLevel suppress_decl : SuppressLevel.values()) {
|
||||||
|
@ -134,6 +134,7 @@ public class InterruptedExceptionTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
XlintOption xlint;
|
XlintOption xlint;
|
||||||
SuppressLevel suppress_decl;
|
SuppressLevel suppress_decl;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -161,6 +161,7 @@ public class UnusedResourcesTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
try {
|
||||||
for (XlintOption xlint : XlintOption.values()) {
|
for (XlintOption xlint : XlintOption.values()) {
|
||||||
for (SuppressLevel suppressLevel : SuppressLevel.values()) {
|
for (SuppressLevel suppressLevel : SuppressLevel.values()) {
|
||||||
for (ResourceUsage usage1 : ResourceUsage.values()) {
|
for (ResourceUsage usage1 : ResourceUsage.values()) {
|
||||||
|
@ -176,6 +177,9 @@ public class UnusedResourcesTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a single file manager and reuse it for each compile to save time.
|
// Create a single file manager and reuse it for each compile to save time.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -41,7 +41,7 @@ public class VerifyAnnotationsAttributed {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
File testFile = new File(testSrc, args[0]);
|
File testFile = new File(testSrc, args[0]);
|
||||||
if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
|
if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
|
||||||
JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
|
try (JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null)) {
|
||||||
JavacTask task = JavacTool.create().getTask(null,
|
JavacTask task = JavacTool.create().getTask(null,
|
||||||
fm,
|
fm,
|
||||||
null,
|
null,
|
||||||
|
@ -75,4 +75,5 @@ public class VerifyAnnotationsAttributed {
|
||||||
}
|
}
|
||||||
}.scan(cut, null);
|
}.scan(cut, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -102,8 +102,7 @@ public class Helper {
|
||||||
throw new RuntimeException("can't get javax.tools.JavaCompiler!");
|
throw new RuntimeException("can't get javax.tools.JavaCompiler!");
|
||||||
}
|
}
|
||||||
|
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
// Assuming filesCount can maximum be 2 and if true, one file is package-info.java
|
// Assuming filesCount can maximum be 2 and if true, one file is package-info.java
|
||||||
if (isPkgInfoPresent(files)) {
|
if (isPkgInfoPresent(files)) {
|
||||||
JavacTask task = (JavacTask) compiler.getTask(null, fm, diagnostics, null, null, files);
|
JavacTask task = (JavacTask) compiler.getTask(null, fm, diagnostics, null, null, files);
|
||||||
|
@ -125,6 +124,9 @@ public class Helper {
|
||||||
ok = task.call();
|
ok = task.call();
|
||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static private boolean isPkgInfoPresent(Iterable<? extends JavaFileObject> files) {
|
static private boolean isPkgInfoPresent(Iterable<? extends JavaFileObject> files) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -46,7 +46,7 @@ public class AnnotatedArrayOrder {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
PrintWriter out = new PrintWriter(System.out, true);
|
PrintWriter out = new PrintWriter(System.out, true);
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
Iterable<? extends JavaFileObject> f =
|
Iterable<? extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "AnnotatedArrayOrder.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "AnnotatedArrayOrder.java")));
|
||||||
|
@ -57,7 +57,7 @@ public class AnnotatedArrayOrder {
|
||||||
Scanner s = new Scanner();
|
Scanner s = new Scanner();
|
||||||
for (CompilationUnitTree t: trees)
|
for (CompilationUnitTree t: trees)
|
||||||
s.scan(t, null);
|
s.scan(t, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Scanner extends TreeScanner<Void,Void> {
|
private static class Scanner extends TreeScanner<Void,Void> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -48,7 +48,7 @@ public class ArrayCreationTree {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
PrintWriter out = new PrintWriter(System.out, true);
|
PrintWriter out = new PrintWriter(System.out, true);
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
Iterable<? extends JavaFileObject> f =
|
Iterable<? extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayCreationTree.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayCreationTree.java")));
|
||||||
|
@ -59,7 +59,7 @@ public class ArrayCreationTree {
|
||||||
Scanner s = new Scanner();
|
Scanner s = new Scanner();
|
||||||
for (CompilationUnitTree t: trees)
|
for (CompilationUnitTree t: trees)
|
||||||
s.scan(t, null);
|
s.scan(t, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Scanner extends TreeScanner<Void,Void> {
|
private static class Scanner extends TreeScanner<Void,Void> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -47,7 +47,7 @@ public class ArrayPositionConsistency {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
PrintWriter out = new PrintWriter(System.out, true);
|
PrintWriter out = new PrintWriter(System.out, true);
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
Iterable<? extends JavaFileObject> f =
|
Iterable<? extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayPositionConsistency.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "ArrayPositionConsistency.java")));
|
||||||
|
@ -58,7 +58,7 @@ public class ArrayPositionConsistency {
|
||||||
Scanner s = new Scanner();
|
Scanner s = new Scanner();
|
||||||
for (CompilationUnitTree t: trees)
|
for (CompilationUnitTree t: trees)
|
||||||
s.scan(t, null);
|
s.scan(t, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class Scanner extends TreeScanner<Void,Void> {
|
private static class Scanner extends TreeScanner<Void,Void> {
|
||||||
|
|
|
@ -72,7 +72,7 @@ public class CheckErrorsForSource7 {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
File testFile = new File(testSrc, args[0]);
|
File testFile = new File(testSrc, args[0]);
|
||||||
if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
|
if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
|
||||||
JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null);
|
try (JavacFileManager fm = JavacTool.create().getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
//gather spans of the @TA annotations into typeAnnotationSpans:
|
//gather spans of the @TA annotations into typeAnnotationSpans:
|
||||||
JavacTask task = JavacTool.create().getTask(null,
|
JavacTask task = JavacTool.create().getTask(null,
|
||||||
|
@ -145,6 +145,7 @@ public class CheckErrorsForSource7 {
|
||||||
throw new IllegalStateException("Did not produce proper errors for: " + updated);
|
throw new IllegalStateException("Did not produce proper errors for: " + updated);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static final Set<String> EXPECTED_ERRORS = new HashSet<>(Arrays.asList(
|
static final Set<String> EXPECTED_ERRORS = new HashSet<>(Arrays.asList(
|
||||||
"compiler.err.type.annotations.not.supported.in.source",
|
"compiler.err.type.annotations.not.supported.in.source",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -46,7 +46,7 @@ public class T6420409 {
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||||
final StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
fm.setLocation(SOURCE_PATH, Arrays.asList(test_classes)); // switcheroo !!!
|
fm.setLocation(SOURCE_PATH, Arrays.asList(test_classes)); // switcheroo !!!
|
||||||
fm.setLocation(CLASS_PATH, Arrays.asList(test_src));
|
fm.setLocation(CLASS_PATH, Arrays.asList(test_src));
|
||||||
fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
|
fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
|
||||||
|
@ -62,6 +62,7 @@ public class T6420409 {
|
||||||
test(fm.getLocation(SOURCE_PATH), test_classes, SOURCE_PATH);
|
test(fm.getLocation(SOURCE_PATH), test_classes, SOURCE_PATH);
|
||||||
test(fm.getLocation(CLASS_OUTPUT), test_classes, CLASS_OUTPUT);
|
test(fm.getLocation(CLASS_OUTPUT), test_classes, CLASS_OUTPUT);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void test(Iterable<? extends File> path, File file, Location location) {
|
static void test(Iterable<? extends File> path, File file, Location location) {
|
||||||
Iterator<? extends File> it = path.iterator();
|
Iterator<? extends File> it = path.iterator();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,7 +38,7 @@ public class T6420464 {
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager mgr = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager mgr = compiler.getStandardFileManager(null, null, null)) {
|
||||||
mgr.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(test_src));
|
mgr.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(test_src));
|
||||||
JavaFileObject f = mgr.getJavaFileForInput(StandardLocation.SOURCE_PATH,
|
JavaFileObject f = mgr.getJavaFileForInput(StandardLocation.SOURCE_PATH,
|
||||||
"T6420464",
|
"T6420464",
|
||||||
|
@ -49,4 +49,5 @@ public class T6420464 {
|
||||||
throw new AssertionError("isNameCompatible(OTHER) fails on " + f.toUri());
|
throw new AssertionError("isNameCompatible(OTHER) fails on " + f.toUri());
|
||||||
System.out.println("OK");
|
System.out.println("OK");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,7 @@ public class T6431435 {
|
||||||
String testSrc = System.getProperty("test.src", ".");
|
String testSrc = System.getProperty("test.src", ".");
|
||||||
String testClasses = System.getProperty("test.classes", ".");
|
String testClasses = System.getProperty("test.classes", ".");
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
||||||
fm.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(new File(testSrc)));
|
fm.setLocation(StandardLocation.SOURCE_PATH, Arrays.asList(new File(testSrc)));
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjectsFromFiles(Arrays.asList(
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjectsFromFiles(Arrays.asList(
|
||||||
|
@ -52,6 +52,7 @@ public class T6431435 {
|
||||||
if (!ok)
|
if (!ok)
|
||||||
throw new AssertionError("Test failed");
|
throw new AssertionError("Test failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static boolean check(String name, Iterable<?> iter, int expect) {
|
private static boolean check(String name, Iterable<?> iter, int expect) {
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -66,11 +66,12 @@ public class T7086261 {
|
||||||
|
|
||||||
void test() throws Throwable {
|
void test() throws Throwable {
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
JavaFileManager jfm = javac.getStandardFileManager(null, null, null);
|
try (JavaFileManager jfm = javac.getStandardFileManager(null, null, null)) {
|
||||||
JavaCompiler.CompilationTask task =
|
JavaCompiler.CompilationTask task =
|
||||||
javac.getTask(null, jfm, new DiagnosticChecker(), null, null, Arrays.asList(new ErroneousSource()));
|
javac.getTask(null, jfm, new DiagnosticChecker(), null, null, Arrays.asList(new ErroneousSource()));
|
||||||
task.call();
|
task.call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Throwable {
|
public static void main(String[] args) throws Throwable {
|
||||||
new T7086261().test();
|
new T7086261().test();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -83,7 +83,7 @@ public class Test {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
File thisFile = new File(testSrc, getClass().getName() + ".java");
|
File thisFile = new File(testSrc, getClass().getName() + ".java");
|
||||||
JavacTool javac = JavacTool.create();
|
JavacTool javac = JavacTool.create();
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) {
|
||||||
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
||||||
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
|
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjects(thisFile);
|
||||||
testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
|
testAnnoProcessor(javac, fm, fos, out, EXPECT_DOC_COMMENTS);
|
||||||
|
@ -92,6 +92,7 @@ public class Test {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm,
|
void testAnnoProcessor(JavacTool javac, StandardJavaFileManager fm,
|
||||||
Iterable<? extends JavaFileObject> files, PrintWriter out,
|
Iterable<? extends JavaFileObject> files, PrintWriter out,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,7 @@ import static javax.tools.JavaFileObject.Kind.CLASS;
|
||||||
public class Sibling {
|
public class Sibling {
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
JavaFileObject sibling =
|
JavaFileObject sibling =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File("Test.java")))
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File("Test.java")))
|
||||||
.iterator().next();
|
.iterator().next();
|
||||||
|
@ -52,4 +52,5 @@ public class Sibling {
|
||||||
throw new AssertionError("Expected " + file.toURI() + ", got " +
|
throw new AssertionError("Expected " + file.toURI() + ", got " +
|
||||||
classFile.toUri());
|
classFile.toUri());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -33,7 +33,7 @@ import java.util.Arrays;
|
||||||
import javax.tools.*;
|
import javax.tools.*;
|
||||||
|
|
||||||
public class T6258271 {
|
public class T6258271 {
|
||||||
public static void main(String... args) {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() {
|
DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() {
|
||||||
public void report(Diagnostic<? extends JavaFileObject> message) {
|
public void report(Diagnostic<? extends JavaFileObject> message) {
|
||||||
|
@ -43,9 +43,10 @@ public class T6258271 {
|
||||||
System.out.println(message);
|
System.out.println(message);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromStrings(Arrays.asList("nofile.java"));
|
fm.getJavaFileObjectsFromStrings(Arrays.asList("nofile.java"));
|
||||||
javac.getTask(null, fm, dl, null, null, files).call();
|
javac.getTask(null, fm, dl, null, null, files).call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,11 +29,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import javax.tools.*;
|
import javax.tools.*;
|
||||||
|
|
||||||
public class T6265137 {
|
public class T6265137 {
|
||||||
public static void main(String... args) {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler javac = ToolProvider.getSystemJavaCompiler();
|
||||||
DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() {
|
DiagnosticListener<JavaFileObject> dl = new DiagnosticListener<JavaFileObject>() {
|
||||||
public void report(Diagnostic<? extends JavaFileObject> message) {
|
public void report(Diagnostic<? extends JavaFileObject> message) {
|
||||||
|
@ -45,10 +46,11 @@ public class T6265137 {
|
||||||
System.out.flush();
|
System.out.flush();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(dl, null, null)) {
|
||||||
String srcdir = System.getProperty("test.src");
|
String srcdir = System.getProperty("test.src");
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(srcdir, "T6265137a.java")));
|
||||||
javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
|
javac.getTask(null, fm, dl, Arrays.asList("-target","9"), null, files).call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -87,10 +87,18 @@ public class T6306137 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void close() throws IOException {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
T6306137 self = new T6306137();
|
T6306137 self = new T6306137();
|
||||||
|
try {
|
||||||
self.test("utf-8", true);
|
self.test("utf-8", true);
|
||||||
self.test("ascii", false);
|
self.test("ascii", false);
|
||||||
self.test("utf-8", true);
|
self.test("utf-8", true);
|
||||||
|
} finally {
|
||||||
|
self.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -45,7 +45,7 @@ public class T6345974 {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
PrintWriter out = new PrintWriter(System.out, true);
|
PrintWriter out = new PrintWriter(System.out, true);
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
File testSrc = new File(System.getProperty("test.src"));
|
File testSrc = new File(System.getProperty("test.src"));
|
||||||
Iterable<? extends JavaFileObject> f =
|
Iterable<? extends JavaFileObject> f =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "T6345974.java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, "T6345974.java")));
|
||||||
|
@ -57,6 +57,7 @@ public class T6345974 {
|
||||||
for (CompilationUnitTree t: trees)
|
for (CompilationUnitTree t: trees)
|
||||||
s.scan(t, null);
|
s.scan(t, null);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static class Scanner extends TreeScanner<Void,Void> {
|
private static class Scanner extends TreeScanner<Void,Void> {
|
||||||
public Void visitPrimitiveType(PrimitiveTypeTree node, Void ignore) {
|
public Void visitPrimitiveType(PrimitiveTypeTree node, Void ignore) {
|
||||||
|
|
|
@ -33,11 +33,11 @@ import com.sun.source.util.*;
|
||||||
|
|
||||||
public class T6357331
|
public class T6357331
|
||||||
{
|
{
|
||||||
public static void main(String... args) {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||||
PrintWriter out = new PrintWriter(new StringWriter());
|
PrintWriter out = new PrintWriter(new StringWriter());
|
||||||
List<String> opts = Arrays.asList("-d", ".");
|
List<String> opts = Arrays.asList("-d", ".");
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
File thisFile = new File(System.getProperty("test.src"), "T6357331.java");
|
File thisFile = new File(System.getProperty("test.src"), "T6357331.java");
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(thisFile);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(thisFile);
|
||||||
final JavacTask task = (JavacTask) (tool.getTask(out, fm, null, opts, null, files));
|
final JavacTask task = (JavacTask) (tool.getTask(out, fm, null, opts, null, files));
|
||||||
|
@ -71,4 +71,5 @@ public class T6357331
|
||||||
// expected
|
// expected
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -44,7 +44,7 @@ import javax.tools.*;
|
||||||
public class T6358786 {
|
public class T6358786 {
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
String srcdir = System.getProperty("test.src");
|
String srcdir = System.getProperty("test.src");
|
||||||
File file = new File(srcdir, args[0]);
|
File file = new File(srcdir, args[0]);
|
||||||
JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
|
JavacTaskImpl task = (JavacTaskImpl)tool.getTask(null, fm, null, null, null, fm.getJavaFileObjectsFromFiles(Arrays.asList(file)));
|
||||||
|
@ -56,4 +56,5 @@ public class T6358786 {
|
||||||
System.out.format("%s: %s%n", clazz.getSimpleName(), doc);
|
System.out.format("%s: %s%n", clazz.getSimpleName(), doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -36,7 +36,7 @@ import static javax.tools.JavaFileObject.Kind.*;
|
||||||
public class T6358955 {
|
public class T6358955 {
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager jfm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
File dir = new File("temp" + args.hashCode());
|
File dir = new File("temp" + args.hashCode());
|
||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
|
@ -67,4 +67,5 @@ public class T6358955 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -38,7 +38,7 @@ public class T6392782 {
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
String testSrc = System.getProperty("test.src", ".");
|
String testSrc = System.getProperty("test.src", ".");
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6392782.class.getName()+".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6392782.class.getName()+".java")));
|
||||||
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
||||||
|
@ -49,11 +49,12 @@ public class T6392782 {
|
||||||
CountNodes nodeCounter = new CountNodes();
|
CountNodes nodeCounter = new CountNodes();
|
||||||
// 359 nodes with the regular parser; 360 nodes with EndPosParser
|
// 359 nodes with the regular parser; 360 nodes with EndPosParser
|
||||||
// We automatically switch to EndPosParser when calling JavacTask.parse()
|
// We automatically switch to EndPosParser when calling JavacTask.parse()
|
||||||
check(nodeCounter, 360, nodeCounter.scan(trees, null));
|
check(nodeCounter, 362, nodeCounter.scan(trees, null));
|
||||||
|
|
||||||
CountIdentifiers idCounter = new CountIdentifiers();
|
CountIdentifiers idCounter = new CountIdentifiers();
|
||||||
check(idCounter, 107, idCounter.scan(trees, null));
|
check(idCounter, 107, idCounter.scan(trees, null));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static void check(TreeScanner<?,?> scanner, int expect, int found) {
|
private static void check(TreeScanner<?,?> scanner, int expect, int found) {
|
||||||
if (found != expect)
|
if (found != expect)
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -65,18 +65,17 @@ public class T6397104 {
|
||||||
void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
|
void test(boolean hasLocation, File siblingFile, String relName, String expectedPath)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
StandardJavaFileManager fm;
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
if (hasLocation) {
|
if (hasLocation) {
|
||||||
for (Location location : StandardLocation.values()) {
|
for (Location location : StandardLocation.values()) {
|
||||||
fm = tool.getStandardFileManager(null, null, null);
|
|
||||||
fm.setLocation(location, Arrays.asList(new File(".")));
|
fm.setLocation(location, Arrays.asList(new File(".")));
|
||||||
test(fm, location, siblingFile, relName, expectedPath);
|
test(fm, location, siblingFile, relName, expectedPath);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fm = tool.getStandardFileManager(null, null, null);
|
|
||||||
test(fm, CLASS_OUTPUT, siblingFile, relName, expectedPath);
|
test(fm, CLASS_OUTPUT, siblingFile, relName, expectedPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
T6397104 tester = new T6397104();
|
T6397104 tester = new T6397104();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -28,13 +28,14 @@
|
||||||
* @author Peter von der Ah\u00e9
|
* @author Peter von der Ah\u00e9
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import javax.tools.*;
|
import javax.tools.*;
|
||||||
import static javax.tools.StandardLocation.*;
|
import static javax.tools.StandardLocation.*;
|
||||||
|
|
||||||
public class T6400205 {
|
public class T6400205 {
|
||||||
public static void main(String... args) {
|
public static void main(String... args) throws IOException {
|
||||||
JavaFileManager fm =
|
try (JavaFileManager fm =
|
||||||
ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
|
ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
|
||||||
try {
|
try {
|
||||||
fm.getClassLoader(null);
|
fm.getClassLoader(null);
|
||||||
throw new AssertionError("NullPointerException not thrown");
|
throw new AssertionError("NullPointerException not thrown");
|
||||||
|
@ -46,4 +47,5 @@ public class T6400205 {
|
||||||
throw new AssertionError("non-null class loader for bogus location");
|
throw new AssertionError("non-null class loader for bogus location");
|
||||||
System.err.println("Test PASSED.");
|
System.err.println("Test PASSED.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -61,8 +61,8 @@ public class T6400207 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
JavaFileManager fm =
|
try (JavaFileManager fm =
|
||||||
ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
|
ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
|
||||||
JavaFileManager.Location bogusLocation = locationFor("bogus");
|
JavaFileManager.Location bogusLocation = locationFor("bogus");
|
||||||
JavaFileManager.Location knownLocation = CLASS_PATH;
|
JavaFileManager.Location knownLocation = CLASS_PATH;
|
||||||
String packageName = "java.lang";
|
String packageName = "java.lang";
|
||||||
|
@ -85,4 +85,5 @@ public class T6400207 {
|
||||||
|
|
||||||
System.err.println("Test PASSED.");
|
System.err.println("Test PASSED.");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -64,7 +64,7 @@ public class T6412669 extends AbstractProcessor {
|
||||||
//System.err.println("toolsClasses: " + toolsClasses);
|
//System.err.println("toolsClasses: " + toolsClasses);
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses, toolsClasses));
|
fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses, toolsClasses));
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6412669.class.getName()+".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6412669.class.getName()+".java")));
|
||||||
|
@ -81,6 +81,7 @@ public class T6412669 extends AbstractProcessor {
|
||||||
if (!out.contains("processing element"))
|
if (!out.contains("processing element"))
|
||||||
throw new AssertionError("expected text not found in compilation output");
|
throw new AssertionError("expected text not found in compilation output");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
Trees trees = Trees.instance(processingEnv);
|
Trees trees = Trees.instance(processingEnv);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -35,7 +35,7 @@ import javax.tools.*;
|
||||||
public class T6419926 {
|
public class T6419926 {
|
||||||
public static void main(String[] argv) throws Exception {
|
public static void main(String[] argv) throws Exception {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>(), null, null);
|
try (StandardJavaFileManager mgr = compiler.getStandardFileManager( new DiagnosticCollector<JavaFileObject>(), null, null)) {
|
||||||
System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
|
System.out.println( new File( new File(".").toURI() ).getAbsolutePath() );
|
||||||
mgr.setLocation(StandardLocation.CLASS_OUTPUT,
|
mgr.setLocation(StandardLocation.CLASS_OUTPUT,
|
||||||
Collections.singleton(new File(".")));
|
Collections.singleton(new File(".")));
|
||||||
|
@ -48,4 +48,5 @@ public class T6419926 {
|
||||||
if (!"file".equals(uri.getScheme()))
|
if (!"file".equals(uri.getScheme()))
|
||||||
throw new Exception("unexpected scheme for uri: " + uri.getScheme());
|
throw new Exception("unexpected scheme for uri: " + uri.getScheme());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -134,7 +134,7 @@
|
||||||
System.err.println("test task API: " + pcp);
|
System.err.println("test task API: " + pcp);
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
if (pcp != null)
|
if (pcp != null)
|
||||||
fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
|
fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
|
||||||
|
@ -150,6 +150,7 @@
|
||||||
checkCompilationOK(ok);
|
checkCompilationOK(ok);
|
||||||
checkOutput(out, expectWarnings);
|
checkOutput(out, expectWarnings);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//----- utility methods
|
//----- utility methods
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -39,7 +39,7 @@ public class T6431879 {
|
||||||
String testSrc = System.getProperty("test.src", ".");
|
String testSrc = System.getProperty("test.src", ".");
|
||||||
String testClasses = System.getProperty("test.classes", ".");
|
String testClasses = System.getProperty("test.classes", ".");
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6431879.class.getName()+".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6431879.class.getName()+".java")));
|
||||||
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
JavacTask task = tool.getTask(null, fm, null, null, null, files);
|
||||||
|
@ -50,7 +50,7 @@ public class T6431879 {
|
||||||
//System.err.println("scan " + unit);
|
//System.err.println("scan " + unit);
|
||||||
dependencyScanner.scan(unit, treeUtil);
|
dependencyScanner.scan(unit, treeUtil);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class DependencyScanner<R,P> extends TreePathScanner<R,P> {
|
private static class DependencyScanner<R,P> extends TreePathScanner<R,P> {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -42,7 +42,7 @@ public class T6483788 {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
File jar = createJar();
|
File jar = createJar();
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
fm.setLocation(StandardLocation.CLASS_PATH, Collections.singleton(jar));
|
fm.setLocation(StandardLocation.CLASS_PATH, Collections.singleton(jar));
|
||||||
JavaFileObject fo = fm.getJavaFileForInput(StandardLocation.CLASS_PATH, "dummy", JavaFileObject.Kind.CLASS);
|
JavaFileObject fo = fm.getJavaFileForInput(StandardLocation.CLASS_PATH, "dummy", JavaFileObject.Kind.CLASS);
|
||||||
System.err.println("file: " + fo);
|
System.err.println("file: " + fo);
|
||||||
|
@ -51,6 +51,7 @@ public class T6483788 {
|
||||||
if (uri.toString().contains(" "))
|
if (uri.toString().contains(" "))
|
||||||
throw new Exception("unexpected space character found");
|
throw new Exception("unexpected space character found");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
File createJar() throws IOException {
|
File createJar() throws IOException {
|
||||||
byte[] dummy_data = new byte[10];
|
byte[] dummy_data = new byte[10];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -46,7 +46,8 @@ public class T6501502 {
|
||||||
// we test a number of platform-independent paths.
|
// we test a number of platform-independent paths.
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager sfm = c.getStandardFileManager(null, null, null)) {
|
||||||
|
fm = sfm;
|
||||||
System.err.println(System.getProperties());
|
System.err.println(System.getProperties());
|
||||||
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
|
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
|
||||||
File testSrcDir = new File(System.getProperty("test.src"));
|
File testSrcDir = new File(System.getProperty("test.src"));
|
||||||
|
@ -57,6 +58,7 @@ public class T6501502 {
|
||||||
test(new File(testClassesDir, "T6501501.class"));
|
test(new File(testClassesDir, "T6501501.class"));
|
||||||
test(new File("a b"));
|
test(new File("a b"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void test(File f) throws Exception {
|
void test(File f) throws Exception {
|
||||||
System.err.println("test " + f);
|
System.err.println("test " + f);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -56,7 +56,8 @@ public class TestClientCodeWrapper extends JavacTestingAbstractProcessor {
|
||||||
*/
|
*/
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
defaultFileManager = compiler.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
|
defaultFileManager = fm;
|
||||||
|
|
||||||
for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) {
|
for (Method m: getMethodsExcept(JavaFileManager.class, "close", "getJavaFileForInput")) {
|
||||||
test(m);
|
test(m);
|
||||||
|
@ -85,6 +86,7 @@ public class TestClientCodeWrapper extends JavacTestingAbstractProcessor {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Get a sorted set of the methods declared on a class. */
|
/** Get a sorted set of the methods declared on a class. */
|
||||||
Set<Method> getMethods(Class<?> clazz) {
|
Set<Method> getMethods(Class<?> clazz) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -52,8 +52,7 @@ public class TestDocComments {
|
||||||
File file = new File(testSrc, "TestDocComments.java");
|
File file = new File(testSrc, "TestDocComments.java");
|
||||||
|
|
||||||
JavacTool tool = JavacTool.create();
|
JavacTool tool = JavacTool.create();
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
PrintWriter pw = new PrintWriter(sw);
|
PrintWriter pw = new PrintWriter(sw);
|
||||||
Iterable<? extends JavaFileObject> fileObjects = fm.getJavaFileObjects(file);
|
Iterable<? extends JavaFileObject> fileObjects = fm.getJavaFileObjects(file);
|
||||||
|
@ -70,6 +69,7 @@ public class TestDocComments {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* class-CommentScanner.
|
* class-CommentScanner.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -50,7 +50,7 @@ public class TestGetElementReference {
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
File source = new File(System.getProperty("test.src", "."), "TestGetElementReferenceData.java").getAbsoluteFile();
|
File source = new File(System.getProperty("test.src", "."), "TestGetElementReferenceData.java").getAbsoluteFile();
|
||||||
StandardJavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = ToolProvider.getSystemJavaCompiler().getStandardFileManager(null, null, null)) {
|
||||||
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
|
DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<>();
|
||||||
JavacTask ct = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, diagnostics, Arrays.asList("-Xjcov"), null, fm.getJavaFileObjects(source));
|
JavacTask ct = (JavacTask) ToolProvider.getSystemJavaCompiler().getTask(null, null, diagnostics, Arrays.asList("-Xjcov"), null, fm.getJavaFileObjects(source));
|
||||||
Trees trees = Trees.instance(ct);
|
Trees trees = Trees.instance(ct);
|
||||||
|
@ -78,6 +78,7 @@ public class TestGetElementReference {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static TreePath pathFor(final Trees trees, final CompilationUnitTree cut, final int pos) {
|
private static TreePath pathFor(final Trees trees, final CompilationUnitTree cut, final int pos) {
|
||||||
final TreePath[] result = new TreePath[1];
|
final TreePath[] result = new TreePath[1];
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
import com.sun.source.tree.IdentifierTree;
|
import com.sun.source.tree.IdentifierTree;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -51,16 +52,16 @@ import javax.lang.model.SourceVersion;
|
||||||
|
|
||||||
@SupportedAnnotationTypes("*")
|
@SupportedAnnotationTypes("*")
|
||||||
public class TestGetScope extends AbstractProcessor {
|
public class TestGetScope extends AbstractProcessor {
|
||||||
public static void main(String... args) {
|
public static void main(String... args) throws IOException {
|
||||||
new TestGetScope().run();
|
new TestGetScope().run();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void run() {
|
public void run() throws IOException {
|
||||||
File srcDir = new File(System.getProperty("test.src"));
|
File srcDir = new File(System.getProperty("test.src"));
|
||||||
File thisFile = new File(srcDir, getClass().getName() + ".java");
|
File thisFile = new File(srcDir, getClass().getName() + ".java");
|
||||||
|
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
List<String> opts = Arrays.asList("-proc:only", "-doe");
|
List<String> opts = Arrays.asList("-proc:only", "-doe");
|
||||||
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(thisFile);
|
Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(thisFile);
|
||||||
|
@ -70,6 +71,7 @@ public class TestGetScope extends AbstractProcessor {
|
||||||
if (!ok)
|
if (!ok)
|
||||||
throw new Error("compilation failed");
|
throw new Error("compilation failed");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -41,8 +41,8 @@ import javax.tools.ToolProvider;
|
||||||
|
|
||||||
public class TestJavacTask {
|
public class TestJavacTask {
|
||||||
static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
static final JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
|
static final StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
||||||
static JavacTaskImpl getTask(File... file) {
|
static JavacTaskImpl getTask(File... file) {
|
||||||
StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null);
|
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(file));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(file));
|
||||||
return (JavacTaskImpl)compiler.getTask(null, fm, null, null, null, files);
|
return (JavacTaskImpl)compiler.getTask(null, fm, null, null, null, files);
|
||||||
|
@ -69,7 +69,11 @@ public class TestJavacTask {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
|
try {
|
||||||
basicTest(args);
|
basicTest(args);
|
||||||
checkKindError();
|
checkKindError();
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,7 +67,7 @@ public class TestJavacTask_Lock {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
comp = ToolProvider.getSystemJavaCompiler();
|
comp = ToolProvider.getSystemJavaCompiler();
|
||||||
fm = comp.getStandardFileManager(null, null, null);
|
fm = comp.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
for (MethodKind first: MethodKind.values()) {
|
for (MethodKind first: MethodKind.values()) {
|
||||||
for (MethodKind second: MethodKind.values()) {
|
for (MethodKind second: MethodKind.values()) {
|
||||||
test(first, second);
|
test(first, second);
|
||||||
|
@ -76,6 +76,9 @@ public class TestJavacTask_Lock {
|
||||||
|
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors found");
|
throw new Exception(errors + " errors found");
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test(MethodKind first, MethodKind second) {
|
void test(MethodKind first, MethodKind second) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -68,6 +68,7 @@ public class TestJavacTask_Multiple {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
for (TestKind tk: TestKind.values()) {
|
for (TestKind tk: TestKind.values()) {
|
||||||
test(comp, fm, tk);
|
test(comp, fm, tk);
|
||||||
}
|
}
|
||||||
|
@ -77,7 +78,9 @@ public class TestJavacTask_Multiple {
|
||||||
throw new Exception("Unexpected number of tests completed: " + count
|
throw new Exception("Unexpected number of tests completed: " + count
|
||||||
+ ", expected: " + expect);
|
+ ", expected: " + expect);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test(JavaCompiler comp, StandardJavaFileManager fm, TestKind tk) {
|
void test(JavaCompiler comp, StandardJavaFileManager fm, TestKind tk) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -45,7 +45,7 @@ public class TestJavacTask_ParseAttrGen {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
comp = ToolProvider.getSystemJavaCompiler();
|
comp = ToolProvider.getSystemJavaCompiler();
|
||||||
fm = comp.getStandardFileManager(null, null, null);
|
fm = comp.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
final boolean[] booleanValues = { false, true };
|
final boolean[] booleanValues = { false, true };
|
||||||
for (boolean pk: booleanValues) {
|
for (boolean pk: booleanValues) {
|
||||||
for (boolean ak: booleanValues) {
|
for (boolean ak: booleanValues) {
|
||||||
|
@ -54,6 +54,9 @@ public class TestJavacTask_ParseAttrGen {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test(boolean pk, boolean ak, boolean gk) throws Exception {
|
void test(boolean pk, boolean ak, boolean gk) throws Exception {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class TestSearchPaths {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
compiler = ToolProvider.getSystemJavaCompiler();
|
compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
fileManager = compiler.getStandardFileManager(null, null, null);
|
fileManager = compiler.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
// basic output path
|
// basic output path
|
||||||
testClassOutput();
|
testClassOutput();
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ public class TestSearchPaths {
|
||||||
if (errors > 0) {
|
if (errors > 0) {
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fileManager.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void testClassOutput() throws IOException {
|
void testClassOutput() throws IOException {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -105,8 +105,8 @@ public class TestTreePath extends AbstractProcessor {
|
||||||
|
|
||||||
public void run() throws IOException {
|
public void run() throws IOException {
|
||||||
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fileManager
|
try (StandardJavaFileManager fileManager
|
||||||
= compiler.getStandardFileManager(null, null, null);
|
= compiler.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> tests
|
Iterable<? extends JavaFileObject> tests
|
||||||
= fileManager.getJavaFileObjects(writeTestFile());
|
= fileManager.getJavaFileObjects(writeTestFile());
|
||||||
|
|
||||||
|
@ -117,6 +117,7 @@ public class TestTreePath extends AbstractProcessor {
|
||||||
tests);
|
tests);
|
||||||
task.call();
|
task.call();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
new TestTreePath().run();
|
new TestTreePath().run();
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class TestTrees extends AbstractProcessor {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null);
|
try (StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> files =
|
Iterable<? extends JavaFileObject> files =
|
||||||
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrcDir, self + ".java")));
|
||||||
|
|
||||||
|
@ -98,6 +98,7 @@ public class TestTrees extends AbstractProcessor {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new AssertionError(errors + " errors occurred");
|
throw new AssertionError(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void testElement(Trees trees, Element e) {
|
void testElement(Trees trees, Element e) {
|
||||||
trees.getClass();
|
trees.getClass();
|
||||||
|
|
|
@ -73,7 +73,7 @@ public class CompileEvent {
|
||||||
assertOutput(out.toString());
|
assertOutput(out.toString());
|
||||||
|
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> testFileObjects = fm.getJavaFileObjects(test);
|
Iterable<? extends JavaFileObject> testFileObjects = fm.getJavaFileObjects(test);
|
||||||
|
|
||||||
//test events fired to listeners registered from plugins
|
//test events fired to listeners registered from plugins
|
||||||
|
@ -86,6 +86,7 @@ public class CompileEvent {
|
||||||
throw new AssertionError("Compilation failed unexpectedly.");
|
throw new AssertionError("Compilation failed unexpectedly.");
|
||||||
assertOutput(out.toString());
|
assertOutput(out.toString());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void assertOutput(String found) {
|
void assertOutput(String found) {
|
||||||
String lineSeparator = System.getProperty("line.separator");
|
String lineSeparator = System.getProperty("line.separator");
|
||||||
|
|
|
@ -44,7 +44,12 @@ public class EventsBalancedTest {
|
||||||
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null);
|
||||||
|
|
||||||
public static void main(String... args) throws IOException {
|
public static void main(String... args) throws IOException {
|
||||||
new EventsBalancedTest().test();
|
EventsBalancedTest t = new EventsBalancedTest();
|
||||||
|
try {
|
||||||
|
t.test();
|
||||||
|
} finally {
|
||||||
|
t.fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test() throws IOException {
|
void test() throws IOException {
|
||||||
|
|
|
@ -203,7 +203,12 @@ public class TestSimpleAddRemove {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
new TestSimpleAddRemove().run();
|
TestSimpleAddRemove t = new TestSimpleAddRemove();
|
||||||
|
try {
|
||||||
|
t.run();
|
||||||
|
} finally {
|
||||||
|
t.fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
|
JavacTool tool = (JavacTool) ToolProvider.getSystemJavaCompiler();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -104,7 +104,7 @@ public class IntersectionTypeParserTest {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (CastKind ck : CastKind.values()) {
|
for (CastKind ck : CastKind.values()) {
|
||||||
for (TypeKind t1 : TypeKind.values()) {
|
for (TypeKind t1 : TypeKind.values()) {
|
||||||
|
@ -134,6 +134,7 @@ public class IntersectionTypeParserTest {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CastKind ck;
|
CastKind ck;
|
||||||
Type[] types;
|
Type[] types;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -68,7 +68,7 @@ public class T7031108 extends JavacTestingAbstractProcessor {
|
||||||
|
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
// step 1: compile test classes
|
// step 1: compile test classes
|
||||||
File cwd = new File(".");
|
File cwd = new File(".");
|
||||||
|
@ -103,6 +103,7 @@ public class T7031108 extends JavacTestingAbstractProcessor {
|
||||||
throw new Exception("unexpected diags received");
|
throw new Exception("unexpected diags received");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void compile(JavaCompiler comp, JavaFileManager fm,
|
void compile(JavaCompiler comp, JavaFileManager fm,
|
||||||
DiagnosticListener<JavaFileObject> dl,
|
DiagnosticListener<JavaFileObject> dl,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -54,7 +54,7 @@ public class DefaultMethodFlags {
|
||||||
|
|
||||||
void checkDefaultMethodFlags() throws IOException {
|
void checkDefaultMethodFlags() throws IOException {
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
Iterable<? extends JavaFileObject> fos =
|
Iterable<? extends JavaFileObject> fos =
|
||||||
fm.getJavaFileObjectsFromFiles(
|
fm.getJavaFileObjectsFromFiles(
|
||||||
Arrays.asList(new File(
|
Arrays.asList(new File(
|
||||||
|
@ -80,6 +80,7 @@ public class DefaultMethodFlags {
|
||||||
|
|
||||||
task.analyze();
|
task.analyze();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void checkDefaultInterface(TypeElement te) {
|
void checkDefaultInterface(TypeElement te) {
|
||||||
System.err.println("Checking " + te.getSimpleName());
|
System.err.println("Checking " + te.getSimpleName());
|
||||||
|
|
|
@ -123,7 +123,7 @@ public class InterfaceMethodHidingTest {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (MethodKind mk1 : MethodKind.values()) {
|
for (MethodKind mk1 : MethodKind.values()) {
|
||||||
for (SignatureKind sk1 : SignatureKind.values()) {
|
for (SignatureKind sk1 : SignatureKind.values()) {
|
||||||
|
@ -146,6 +146,7 @@ public class InterfaceMethodHidingTest {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MethodKind mk1, mk2, mk3;
|
MethodKind mk1, mk2, mk3;
|
||||||
SignatureKind sk1, sk2, sk3;
|
SignatureKind sk1, sk2, sk3;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -188,7 +188,7 @@ public class TestDefaultMethodsSyntax {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (VersionKind vk : VersionKind.values()) {
|
for (VersionKind vk : VersionKind.values()) {
|
||||||
for (EnclosingKind ek : EnclosingKind.values()) {
|
for (EnclosingKind ek : EnclosingKind.values()) {
|
||||||
|
@ -203,6 +203,7 @@ public class TestDefaultMethodsSyntax {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VersionKind vk;
|
VersionKind vk;
|
||||||
EnclosingKind ek;
|
EnclosingKind ek;
|
||||||
|
|
|
@ -313,7 +313,7 @@ public class CheckResourceKeys {
|
||||||
Set<String> getCodeStrings() throws IOException {
|
Set<String> getCodeStrings() throws IOException {
|
||||||
Set<String> results = new TreeSet<String>();
|
Set<String> results = new TreeSet<String>();
|
||||||
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler c = ToolProvider.getSystemJavaCompiler();
|
||||||
JavaFileManager fm = c.getStandardFileManager(null, null, null);
|
try (JavaFileManager fm = c.getStandardFileManager(null, null, null)) {
|
||||||
JavaFileManager.Location javacLoc = findJavacLocation(fm);
|
JavaFileManager.Location javacLoc = findJavacLocation(fm);
|
||||||
String[] pkgs = {
|
String[] pkgs = {
|
||||||
"javax.annotation.processing",
|
"javax.annotation.processing",
|
||||||
|
@ -335,6 +335,7 @@ public class CheckResourceKeys {
|
||||||
}
|
}
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// depending on how the test is run, javac may be on bootclasspath or classpath
|
// depending on how the test is run, javac may be on bootclasspath or classpath
|
||||||
JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
|
JavaFileManager.Location findJavacLocation(JavaFileManager fm) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -109,6 +109,7 @@ public class DocLintTest {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
javac = ToolProvider.getSystemJavaCompiler();
|
javac = ToolProvider.getSystemJavaCompiler();
|
||||||
fm = javac.getStandardFileManager(null, null, null);
|
fm = javac.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
fm.setLocation(StandardLocation.CLASS_OUTPUT, Arrays.asList(new File(".")));
|
||||||
file = new SimpleJavaFileObject(URI.create("Test.java"), JavaFileObject.Kind.SOURCE) {
|
file = new SimpleJavaFileObject(URI.create("Test.java"), JavaFileObject.Kind.SOURCE) {
|
||||||
@Override
|
@Override
|
||||||
|
@ -147,6 +148,9 @@ public class DocLintTest {
|
||||||
|
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
|
void test(List<String> opts, Main.Result expectResult, Set<Message> expectMessages) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -66,7 +66,7 @@ public class DocTreePathScannerTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
JavacTool javac = JavacTool.create();
|
JavacTool javac = JavacTool.create();
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
|
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
|
||||||
|
|
||||||
|
@ -83,6 +83,7 @@ public class DocTreePathScannerTest {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void error(String msg) {
|
void error(String msg) {
|
||||||
System.err.println("Error: " + msg);
|
System.err.println("Error: " + msg);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -66,7 +66,7 @@ public class SimpleDocTreeVisitorTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
JavacTool javac = JavacTool.create();
|
JavacTool javac = JavacTool.create();
|
||||||
StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = javac.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
|
Iterable<? extends JavaFileObject> fos = fm.getJavaFileObjectsFromFiles(files);
|
||||||
|
|
||||||
|
@ -89,6 +89,7 @@ public class SimpleDocTreeVisitorTest {
|
||||||
if (errors > 0)
|
if (errors > 0)
|
||||||
throw new Exception(errors + " errors occurred");
|
throw new Exception(errors + " errors occurred");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void error(String msg) {
|
void error(String msg) {
|
||||||
System.err.println("Error: " + msg);
|
System.err.println("Error: " + msg);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -47,6 +47,7 @@ import javax.lang.model.element.TypeElement;
|
||||||
import javax.tools.Diagnostic.Kind;
|
import javax.tools.Diagnostic.Kind;
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
import javax.tools.JavaCompiler.CompilationTask;
|
import javax.tools.JavaCompiler.CompilationTask;
|
||||||
|
import javax.tools.StandardJavaFileManager;
|
||||||
import javax.tools.StandardLocation;
|
import javax.tools.StandardLocation;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
|
@ -75,8 +76,9 @@ public class T7068451 {
|
||||||
System.err.println("FIRST compilation");
|
System.err.println("FIRST compilation");
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
|
||||||
CompilationTask task = compiler.getTask(null, null, null, opts, null,
|
try (StandardJavaFileManager fm = compiler.getStandardFileManager(null, null, null)) {
|
||||||
compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
|
CompilationTask task = compiler.getTask(null, fm, null, opts, null,
|
||||||
|
fm.getJavaFileObjects(input));
|
||||||
task.setProcessors(Collections.singleton(new Proc("first")));
|
task.setProcessors(Collections.singleton(new Proc("first")));
|
||||||
check("compilation", task.call());
|
check("compilation", task.call());
|
||||||
|
|
||||||
|
@ -88,8 +90,8 @@ public class T7068451 {
|
||||||
System.err.println("SECOND compilation");
|
System.err.println("SECOND compilation");
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
|
||||||
task = compiler.getTask(null, null, null, opts, null,
|
task = compiler.getTask(null, fm, null, opts, null,
|
||||||
compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
|
fm.getJavaFileObjects(input));
|
||||||
task.setProcessors(Collections.singleton(new Proc("second")));
|
task.setProcessors(Collections.singleton(new Proc("second")));
|
||||||
check("compilation", task.call());
|
check("compilation", task.call());
|
||||||
|
|
||||||
|
@ -99,11 +101,12 @@ public class T7068451 {
|
||||||
System.err.println("SECOND compilation, REPEATED");
|
System.err.println("SECOND compilation, REPEATED");
|
||||||
System.err.println();
|
System.err.println();
|
||||||
|
|
||||||
task = compiler.getTask(null, null, null, opts, null,
|
task = compiler.getTask(null, fm, null, opts, null,
|
||||||
compiler.getStandardFileManager(null, null, null).getJavaFileObjects(input));
|
fm.getJavaFileObjects(input));
|
||||||
task.setProcessors(Collections.singleton(new Proc("second")));
|
task.setProcessors(Collections.singleton(new Proc("second")));
|
||||||
check("compilation", task.call());
|
check("compilation", task.call());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void check(String msg, boolean ok) {
|
void check(String msg, boolean ok) {
|
||||||
System.err.println(msg + ": " + (ok ? "ok" : "failed"));
|
System.err.println(msg + ": " + (ok ? "ok" : "failed"));
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class LVTHarness {
|
||||||
static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
String testDir = System.getProperty("test.src");
|
String testDir = System.getProperty("test.src");
|
||||||
fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
|
fm.setLocation(SOURCE_PATH, Arrays.asList(new File(testDir, "tests")));
|
||||||
|
|
||||||
|
@ -89,6 +89,9 @@ public class LVTHarness {
|
||||||
if (nerrors > 0) {
|
if (nerrors > 0) {
|
||||||
throw new AssertionError("Errors were found");
|
throw new AssertionError("Errors were found");
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -70,6 +70,7 @@ public class BridgeHarness {
|
||||||
static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
static final StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
//set sourcepath
|
//set sourcepath
|
||||||
fm.setLocation(SOURCE_PATH,
|
fm.setLocation(SOURCE_PATH,
|
||||||
Arrays.asList(new File(System.getProperty("test.src"), "tests")));
|
Arrays.asList(new File(System.getProperty("test.src"), "tests")));
|
||||||
|
@ -84,6 +85,9 @@ public class BridgeHarness {
|
||||||
if (nerrors > 0) {
|
if (nerrors > 0) {
|
||||||
throw new AssertionError("Errors were found");
|
throw new AssertionError("Errors were found");
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* utility methods */
|
/* utility methods */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -150,8 +150,7 @@ public class GenericConstructorAndDiamondTest {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (BoundKind boundKind : BoundKind.values()) {
|
for (BoundKind boundKind : BoundKind.values()) {
|
||||||
for (ConstructorKind constructorKind : ConstructorKind.values()) {
|
for (ConstructorKind constructorKind : ConstructorKind.values()) {
|
||||||
for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) {
|
for (TypeArgumentKind declArgKind : TypeArgumentKind.values()) {
|
||||||
|
@ -169,6 +168,7 @@ public class GenericConstructorAndDiamondTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
BoundKind boundKind;
|
BoundKind boundKind;
|
||||||
ConstructorKind constructorKind;
|
ConstructorKind constructorKind;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -78,7 +78,7 @@ public class ParserTest {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (TypeQualifierArity arity : TypeQualifierArity.values()) {
|
for (TypeQualifierArity arity : TypeQualifierArity.values()) {
|
||||||
for (TypeArgumentKind tak1 : TypeArgumentKind.values()) {
|
for (TypeArgumentKind tak1 : TypeArgumentKind.values()) {
|
||||||
|
@ -104,6 +104,7 @@ public class ParserTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TypeQualifierArity qualifierArity;
|
TypeQualifierArity qualifierArity;
|
||||||
TypeArgumentKind[] typeArgumentKinds;
|
TypeArgumentKind[] typeArgumentKinds;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -86,7 +86,7 @@ public class T7086601b {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (TypeKind a1 : TypeKind.values()) {
|
for (TypeKind a1 : TypeKind.values()) {
|
||||||
for (TypeKind a2 : TypeKind.values()) {
|
for (TypeKind a2 : TypeKind.values()) {
|
||||||
|
@ -99,6 +99,7 @@ public class T7086601b {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TypeKind a1;
|
TypeKind a1;
|
||||||
TypeKind a2;
|
TypeKind a2;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -105,7 +105,7 @@ public class BadLambdaExpr {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (ParameterListKind plk : ParameterListKind.values()) {
|
for (ParameterListKind plk : ParameterListKind.values()) {
|
||||||
for (ParameterKind pk : ParameterKind.values()) {
|
for (ParameterKind pk : ParameterKind.values()) {
|
||||||
|
@ -118,6 +118,7 @@ public class BadLambdaExpr {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ParameterListKind plk;
|
ParameterListKind plk;
|
||||||
ParameterKind pk;
|
ParameterKind pk;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -114,7 +114,7 @@ public class TestSelfRef {
|
||||||
|
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (EnclosingKind ek : EnclosingKind.values()) {
|
for (EnclosingKind ek : EnclosingKind.values()) {
|
||||||
for (SiteKind sk : SiteKind.values()) {
|
for (SiteKind sk : SiteKind.values()) {
|
||||||
|
@ -131,6 +131,7 @@ public class TestSelfRef {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
EnclosingKind ek;
|
EnclosingKind ek;
|
||||||
SiteKind sk;
|
SiteKind sk;
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class IntersectionTargetTypeTest {
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
//create default shared JavaCompiler - reused across multiple compilations
|
//create default shared JavaCompiler - reused across multiple compilations
|
||||||
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
try (StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
|
||||||
|
|
||||||
for (CastInfo cInfo : allCastInfo()) {
|
for (CastInfo cInfo : allCastInfo()) {
|
||||||
for (ExpressionKind ek : ExpressionKind.values()) {
|
for (ExpressionKind ek : ExpressionKind.values()) {
|
||||||
|
@ -194,6 +194,7 @@ public class IntersectionTargetTypeTest {
|
||||||
}
|
}
|
||||||
System.out.println("Total check executed: " + checkCount);
|
System.out.println("Total check executed: " + checkCount);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static List<CastInfo> allCastInfo() {
|
static List<CastInfo> allCastInfo() {
|
||||||
ListBuffer<CastInfo> buf = new ListBuffer<>();
|
ListBuffer<CastInfo> buf = new ListBuffer<>();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -250,6 +250,7 @@ public class SamConversionComboTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
|
try {
|
||||||
for(Context ct : Context.values()) {
|
for(Context ct : Context.values()) {
|
||||||
for (FInterface fi : FInterface.values()) {
|
for (FInterface fi : FInterface.values()) {
|
||||||
for (MethodDef md: MethodDef.values()) {
|
for (MethodDef md: MethodDef.values()) {
|
||||||
|
@ -258,5 +259,8 @@ public class SamConversionComboTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("total tests: " + count);
|
System.out.println("total tests: " + count);
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -28,6 +28,7 @@ import org.openjdk.tests.shapegen.*;
|
||||||
import com.sun.source.util.JavacTask;
|
import com.sun.source.util.JavacTask;
|
||||||
import com.sun.tools.javac.util.Pair;
|
import com.sun.tools.javac.util.Pair;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -41,6 +42,7 @@ import javax.tools.SimpleJavaFileObject;
|
||||||
import javax.tools.StandardJavaFileManager;
|
import javax.tools.StandardJavaFileManager;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
|
import org.testng.annotations.AfterSuite;
|
||||||
import org.testng.annotations.Test;
|
import org.testng.annotations.Test;
|
||||||
import org.testng.annotations.BeforeSuite;
|
import org.testng.annotations.BeforeSuite;
|
||||||
import org.testng.annotations.DataProvider;
|
import org.testng.annotations.DataProvider;
|
||||||
|
@ -70,12 +72,19 @@ public class FDTest {
|
||||||
fm = comp.getStandardFileManager(null, null, null);
|
fm = comp.getStandardFileManager(null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@AfterSuite
|
||||||
|
static void teardown() throws IOException {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) throws Exception {
|
public static void main(String[] args) throws Exception {
|
||||||
init();
|
init();
|
||||||
|
|
||||||
for (Pair<TestKind,Hierarchy> fdtest : generateCases()) {
|
for (Pair<TestKind,Hierarchy> fdtest : generateCases()) {
|
||||||
runTest(fdtest.fst, fdtest.snd, comp, fm);
|
runTest(fdtest.fst, fdtest.snd, comp, fm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test(dataProvider = "fdCases")
|
@Test(dataProvider = "fdCases")
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
|
@ -193,7 +193,7 @@ public class NativeHeaderTest {
|
||||||
void run() throws Exception {
|
void run() throws Exception {
|
||||||
javac = JavacTool.create();
|
javac = JavacTool.create();
|
||||||
fm = javac.getStandardFileManager(null, null, null);
|
fm = javac.getStandardFileManager(null, null, null);
|
||||||
|
try {
|
||||||
for (RunKind rk: RunKind.values()) {
|
for (RunKind rk: RunKind.values()) {
|
||||||
for (GenKind gk: GenKind.values()) {
|
for (GenKind gk: GenKind.values()) {
|
||||||
for (Method m: getClass().getDeclaredMethods()) {
|
for (Method m: getClass().getDeclaredMethods()) {
|
||||||
|
@ -214,6 +214,9 @@ public class NativeHeaderTest {
|
||||||
System.err.println(testCount + " tests" + ((errorCount == 0) ? "" : ", " + errorCount + " errors"));
|
System.err.println(testCount + " tests" + ((errorCount == 0) ? "" : ", " + errorCount + " errors"));
|
||||||
if (errorCount > 0)
|
if (errorCount > 0)
|
||||||
throw new Exception(errorCount + " errors found");
|
throw new Exception(errorCount + " errors found");
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,6 +45,7 @@ import java.util.regex.Pattern;
|
||||||
|
|
||||||
import javax.tools.JavaCompiler;
|
import javax.tools.JavaCompiler;
|
||||||
import javax.tools.JavaCompiler.CompilationTask;
|
import javax.tools.JavaCompiler.CompilationTask;
|
||||||
|
import javax.tools.StandardJavaFileManager;
|
||||||
import javax.tools.ToolProvider;
|
import javax.tools.ToolProvider;
|
||||||
|
|
||||||
|
|
||||||
|
@ -73,10 +74,11 @@ public class XPreferTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
final static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
final static JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
|
||||||
|
final static StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
|
||||||
final static File OUTPUT_DIR = new File("out");
|
final static File OUTPUT_DIR = new File("out");
|
||||||
|
|
||||||
public static void main(String... args) throws Exception {
|
public static void main(String... args) throws Exception {
|
||||||
|
try {
|
||||||
// Initialize test-directories
|
// Initialize test-directories
|
||||||
OUTPUT_DIR.mkdir();
|
OUTPUT_DIR.mkdir();
|
||||||
for (Dir dir : Dir.values())
|
for (Dir dir : Dir.values())
|
||||||
|
@ -95,6 +97,9 @@ public class XPreferTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
fm.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static class TestCase {
|
static class TestCase {
|
||||||
|
@ -234,8 +239,8 @@ public class XPreferTest {
|
||||||
if(dir == Dir.SOURCE_PATH)
|
if(dir == Dir.SOURCE_PATH)
|
||||||
return src;
|
return src;
|
||||||
// ...otherwise compile into a ".class".
|
// ...otherwise compile into a ".class".
|
||||||
CompilationTask task = comp.getTask(null, null, null, null, null,
|
CompilationTask task = comp.getTask(null, fm, null, null, null,
|
||||||
comp.getStandardFileManager(null, null, null).getJavaFileObjects(src));
|
fm.getJavaFileObjects(src));
|
||||||
File dest = new File(dir.file, classId + ".class");
|
File dest = new File(dir.file, classId + ".class");
|
||||||
if(!task.call() || !dest.exists())
|
if(!task.call() || !dest.exists())
|
||||||
throw new RuntimeException("Compilation failure.");
|
throw new RuntimeException("Compilation failure.");
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue