langtools/test/tools/javac/diags/CheckExamples.java
changeset 7643 a067a0cda531
parent 6926 f0beafc94c59
child 11551 cc9505564baf
equal deleted inserted replaced
7642:9ca5d29b34f7 7643:a067a0cda531
   127     Set<Example> getExamples() {
   127     Set<Example> getExamples() {
   128         Set<Example> results = new TreeSet<Example>();
   128         Set<Example> results = new TreeSet<Example>();
   129         File testSrc = new File(System.getProperty("test.src"));
   129         File testSrc = new File(System.getProperty("test.src"));
   130         File examples = new File(testSrc, "examples");
   130         File examples = new File(testSrc, "examples");
   131         for (File f: examples.listFiles()) {
   131         for (File f: examples.listFiles()) {
   132             if (f.isDirectory() || f.isFile() && f.getName().endsWith(".java"))
   132             if (isValidExample(f))
   133                 results.add(new Example(f));
   133                 results.add(new Example(f));
   134         }
   134         }
   135         return results;
   135         return results;
       
   136     }
       
   137 
       
   138     boolean isValidExample(File f) {
       
   139         return (f.isDirectory() && f.list().length > 0) ||
       
   140                 (f.isFile() && f.getName().endsWith(".java"));
   136     }
   141     }
   137 
   142 
   138     /**
   143     /**
   139      * Get the contents of the "not-yet" list.
   144      * Get the contents of the "not-yet" list.
   140      */
   145      */