--- a/langtools/test/tools/javac/diags/RunExamples.java Mon Dec 13 14:08:01 2010 -0800
+++ b/langtools/test/tools/javac/diags/RunExamples.java Mon Dec 13 15:11:00 2010 -0800
@@ -52,7 +52,7 @@
*/
public class RunExamples {
public static void main(String... args) throws Exception {
- boolean jtreg = (System.getProperty("test.src") != null);
+ jtreg = (System.getProperty("test.src") != null);
File tmpDir;
if (jtreg) {
// use standard jtreg scratch directory: the current directory
@@ -166,12 +166,17 @@
Set<Example> getExamples(File examplesDir) {
Set<Example> results = new TreeSet<Example>();
for (File f: examplesDir.listFiles()) {
- if (f.isDirectory() || f.isFile() && f.getName().endsWith(".java"))
+ if (isValidExample(f))
results.add(new Example(f));
}
return results;
}
+ boolean isValidExample(File f) {
+ return (f.isDirectory() && (!jtreg || f.list().length > 0)) ||
+ (f.isFile() && f.getName().endsWith(".java"));
+ }
+
/**
* Report an error.
*/
@@ -180,6 +185,8 @@
errors++;
}
+ static boolean jtreg;
+
int errors;
/**