/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
// The following two classes are both used, but cannot be imported directly
// import com.sun.tools.javac.Main
// import com.sun.tools.javac.main.Main
/**
* Class to handle example code designed to illustrate javac diagnostic messages.
*/
/* Create an Example from the files found at path.
* The head of the file, up to the first Java code, is scanned
* for information about the test, such as what resource keys it
* generates when run, what options are required to run it, and so on.
*/
parse(f);
}
}
if (f.isDirectory()) {
srcPathDir = c;
findFiles(c, srcPathFiles);
findFiles(c, supportFiles);
else
}
}
}
try {
foundInfo(f);
continue;
}
foundInfo(f);
continue;
}
foundInfo(f);
}
break;
}
} catch (IOException e) {
throw new Error(e);
}
}
}
}
/**
* Get the set of resource keys that this test declares it will generate
* when it is run.
*/
return declaredKeys;
}
/**
* Get the set of resource keys that this test generates when it is run.
* The test will be run if it has not already been run.
*/
if (actualKeys == null)
actualKeys = run(false);
return actualKeys;
}
/**
* Run the test. Information in the test header is used to determine
* how to run the test.
*/
throw new NullPointerException();
try {
} catch (IOException e) {
e.printStackTrace(out);
}
}
try {
} catch (IOException e) {
}
return keys;
}
/**
* Run the test. Information in the test header is used to determine
* how to run the test.
*/
throws IOException {
supportDir.mkdirs();
}
classesDir.mkdirs();
}
if (srcPathDir != null) {
}
try {
} catch (IllegalArgumentException e) {
}
}
}
try {
}
} finally {
}
}
}
}
/**
* Read the contents of a file.
*/
try {
} finally {
}
}
/**
* Clean the contents of a directory.
*/
boolean ok = true;
if (f.isDirectory())
}
return ok;
}
}
abstract static class Compiler {
interface Factory {
}
} else {
}
return new SimpleCompiler(verbose);
return new BackdoorCompiler(verbose);
else
throw new IllegalArgumentException(first);
}
}
factory = new DefaultFactory();
}
}
}
protected boolean verbose;
}
/**
* Compile using the JSR 199 API. The diagnostics generated are
* scanned for resource keys. Not all diagnostic keys are generated
* via the JSR 199 API -- for example, rich diagnostics are not directly
* accessible, and some diagnostics generated by the file manager may
* not be generated (for example, the JSR 199 file manager does not see
* -Xlint:path).
*/
super(verbose);
} else
throw new IllegalArgumentException(arg);
}
}
throw new IllegalArgumentException();
if (verbose)
if (raw) {
}
}
}
return ok;
}
/**
* Scan a diagnostic for resource keys. This will not detect additional
* sub diagnostics that might be generated by a rich diagnostic formatter.
*/
if (o instanceof JCDiagnostic) {
}
}
}
if (diagnostic instanceof JCDiagnostic)
return (JCDiagnostic) diagnostic;
throw new IllegalArgumentException();
}
}
/**
* Run the test using the standard simple entry point.
*/
super(verbose);
}
throw new IllegalArgumentException();
if (verbose)
sw = new StringWriter();
} else
}
return (rc == 0);
}
while (st.hasMoreElements()) {
if (t.startsWith("compiler."))
}
}
}
super(verbose);
}
throw new IllegalArgumentException();
if (verbose)
sw = new StringWriter();
} else
}
return (rc == 0);
}
super(context);
}
return new MessageTracker(c) {
}
};
}
});
}
}
}
}
}