--- a/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Fri Jan 16 14:05:55 2009 -0800
+++ b/langtools/src/share/classes/com/sun/tools/javac/main/Main.java Mon Jan 19 19:36:14 2009 -0800
@@ -338,13 +338,13 @@
return EXIT_CMDERR;
}
- List<File> filenames;
+ List<File> files;
try {
- filenames = processArgs(CommandLine.parse(args));
- if (filenames == null) {
+ files = processArgs(CommandLine.parse(args));
+ if (files == null) {
// null signals an error in options, abort
return EXIT_CMDERR;
- } else if (filenames.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) {
+ } else if (files.isEmpty() && fileObjects.isEmpty() && classnames.isEmpty()) {
// it is allowed to compile nothing if just asking for help or version info
if (options.get("-help") != null
|| options.get("-X") != null
@@ -380,12 +380,14 @@
comp = JavaCompiler.instance(context);
if (comp == null) return EXIT_SYSERR;
- if (!filenames.isEmpty()) {
+ Log log = Log.instance(context);
+
+ if (!files.isEmpty()) {
// add filenames to fileObjects
comp = JavaCompiler.instance(context);
List<JavaFileObject> otherFiles = List.nil();
JavacFileManager dfm = (JavacFileManager)fileManager;
- for (JavaFileObject fo : dfm.getJavaFileObjectsFromFiles(filenames))
+ for (JavaFileObject fo : dfm.getJavaFileObjectsFromFiles(files))
otherFiles = otherFiles.prepend(fo);
for (JavaFileObject fo : otherFiles)
fileObjects = fileObjects.prepend(fo);
@@ -394,6 +396,16 @@
classnames.toList(),
processors);
+ if (log.expectDiagKeys != null) {
+ if (log.expectDiagKeys.size() == 0) {
+ Log.printLines(log.noticeWriter, "all expected diagnostics found");
+ return EXIT_OK;
+ } else {
+ Log.printLines(log.noticeWriter, "expected diagnostic keys not found: " + log.expectDiagKeys);
+ return EXIT_ERROR;
+ }
+ }
+
if (comp.errorCount() != 0 ||
options.get("-Werror") != null && comp.warningCount() != 0)
return EXIT_ERROR;