langtools/test/tools/sjavac/OptionDecoding.java
changeset 32335 7df616378cf3
parent 30730 d3ce7619db2c
child 32337 c9d3ab9f601c
equal deleted inserted replaced
32334:fd65e32e16b3 32335:7df616378cf3
    49 import java.util.HashMap;
    49 import java.util.HashMap;
    50 import java.util.List;
    50 import java.util.List;
    51 import java.util.Map;
    51 import java.util.Map;
    52 
    52 
    53 import com.sun.tools.sjavac.CopyFile;
    53 import com.sun.tools.sjavac.CopyFile;
    54 import com.sun.tools.sjavac.Main;
       
    55 import com.sun.tools.sjavac.Module;
    54 import com.sun.tools.sjavac.Module;
    56 import com.sun.tools.sjavac.Source;
    55 import com.sun.tools.sjavac.Source;
    57 import com.sun.tools.sjavac.client.ClientMain;
    56 import com.sun.tools.sjavac.client.ClientMain;
       
    57 import com.sun.tools.sjavac.comp.SjavacImpl;
    58 import com.sun.tools.sjavac.options.Options;
    58 import com.sun.tools.sjavac.options.Options;
    59 import com.sun.tools.sjavac.options.SourceLocation;
    59 import com.sun.tools.sjavac.options.SourceLocation;
    60 
    60 
    61 public class OptionDecoding {
    61 public class OptionDecoding {
    62 
    62 
   134         // Test -if
   134         // Test -if
   135         {
   135         {
   136             Options options = Options.parseArgs("-if", "root/pkg1/ClassA1.java", "root");
   136             Options options = Options.parseArgs("-if", "root/pkg1/ClassA1.java", "root");
   137 
   137 
   138             Map<String, Source> foundFiles = new HashMap<>();
   138             Map<String, Source> foundFiles = new HashMap<>();
   139             ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   139             SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   140                     new HashMap<String, Module>(), new Module("", ""), false, true);
   140                     new HashMap<String, Module>(), new Module("", ""), false, true);
   141 
   141 
   142             checkFilesFound(foundFiles.keySet(), a1);
   142             checkFilesFound(foundFiles.keySet(), a1);
   143         }
   143         }
   144 
   144 
   146         System.out.println("--------------------------- CHECKING -i ----------------");
   146         System.out.println("--------------------------- CHECKING -i ----------------");
   147         {
   147         {
   148             Options options = Options.parseArgs("-i", "pkg1/*", "root");
   148             Options options = Options.parseArgs("-i", "pkg1/*", "root");
   149 
   149 
   150             Map<String, Source> foundFiles = new HashMap<>();
   150             Map<String, Source> foundFiles = new HashMap<>();
   151             ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   151             SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   152                     new HashMap<String, Module>(), new Module("", ""), false, true);
   152                     new HashMap<String, Module>(), new Module("", ""), false, true);
   153 
   153 
   154             checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
   154             checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
   155         }
   155         }
   156         System.out.println("--------------------------------------------------------");
   156         System.out.println("--------------------------------------------------------");
   158         // Test -xf
   158         // Test -xf
   159         {
   159         {
   160             Options options = Options.parseArgs("-xf", "root/pkg1/ClassA1.java", "root");
   160             Options options = Options.parseArgs("-xf", "root/pkg1/ClassA1.java", "root");
   161 
   161 
   162             Map<String, Source> foundFiles = new HashMap<>();
   162             Map<String, Source> foundFiles = new HashMap<>();
   163             ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   163             SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   164                     new HashMap<String, Module>(), new Module("", ""), false, true);
   164                     new HashMap<String, Module>(), new Module("", ""), false, true);
   165 
   165 
   166             checkFilesFound(foundFiles.keySet(), a2, b1, b2, c1, c2);
   166             checkFilesFound(foundFiles.keySet(), a2, b1, b2, c1, c2);
   167         }
   167         }
   168 
   168 
   169         // Test -x
   169         // Test -x
   170         {
   170         {
   171             Options options = Options.parseArgs("-i", "pkg1/*", "root");
   171             Options options = Options.parseArgs("-i", "pkg1/*", "root");
   172 
   172 
   173             Map<String, Source> foundFiles = new HashMap<>();
   173             Map<String, Source> foundFiles = new HashMap<>();
   174             ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   174             SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   175                     new HashMap<String, Module>(), new Module("", ""), false, true);
   175                     new HashMap<String, Module>(), new Module("", ""), false, true);
   176 
   176 
   177             checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
   177             checkFilesFound(foundFiles.keySet(), a1, a2, b1, b2);
   178         }
   178         }
   179 
   179 
   180         // Test -x and -i
   180         // Test -x and -i
   181         {
   181         {
   182             Options options = Options.parseArgs("-i", "pkg1/*", "-x", "pkg1/pkg2/*", "root");
   182             Options options = Options.parseArgs("-i", "pkg1/*", "-x", "pkg1/pkg2/*", "root");
   183 
   183 
   184             Map<String, Source> foundFiles = new HashMap<>();
   184             Map<String, Source> foundFiles = new HashMap<>();
   185             ClientMain.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   185             SjavacImpl.findSourceFiles(options.getSources(), Collections.singleton(".java"), foundFiles,
   186                     new HashMap<String, Module>(), new Module("", ""), false, true);
   186                     new HashMap<String, Module>(), new Module("", ""), false, true);
   187 
   187 
   188             checkFilesFound(foundFiles.keySet(), a1, a2);
   188             checkFilesFound(foundFiles.keySet(), a1, a2);
   189         }
   189         }
   190 
   190