langtools/test/tools/javac/classfiles/attributes/Module/ModuleTestBase.java
changeset 36778 e04318f39f92
parent 36526 3b41f1c69604
child 40308 274367a99f98
equal deleted inserted replaced
36777:28d33fb9097f 36778:e04318f39f92
     1 /*
     1 /*
     2  * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    40 import java.util.List;
    40 import java.util.List;
    41 import java.util.Map;
    41 import java.util.Map;
    42 import java.util.regex.Pattern;
    42 import java.util.regex.Pattern;
    43 import java.util.stream.Collectors;
    43 import java.util.stream.Collectors;
    44 
    44 
       
    45 import toolbox.JavacTask;
       
    46 import toolbox.Task;
       
    47 import toolbox.ToolBox;
       
    48 
    45 public class ModuleTestBase {
    49 public class ModuleTestBase {
    46     protected final ToolBox tb = new ToolBox();
    50     protected final ToolBox tb = new ToolBox();
    47     private final TestResult tr = new TestResult();
    51     private final TestResult tr = new TestResult();
    48 
    52 
    49 
    53 
   122         }
   126         }
   123         tr.checkContains(actualProvides, moduleDescriptor.provides, "Lists of provides don't match");
   127         tr.checkContains(actualProvides, moduleDescriptor.provides, "Lists of provides don't match");
   124     }
   128     }
   125 
   129 
   126     protected void compile(Path base) throws IOException {
   130     protected void compile(Path base) throws IOException {
   127         tb.new JavacTask()
   131         new JavacTask(tb)
   128                 .files(findJavaFiles(base))
   132                 .files(findJavaFiles(base))
   129                 .run(ToolBox.Expect.SUCCESS)
   133                 .run(Task.Expect.SUCCESS)
   130                 .writeAll();
   134                 .writeAll();
   131     }
   135     }
   132 
   136 
   133     private static Path[] findJavaFiles(Path src) throws IOException {
   137     private static Path[] findJavaFiles(Path src) throws IOException {
   134         return Files.find(src, Integer.MAX_VALUE, (path, attr) -> path.toString().endsWith(".java"))
   138         return Files.find(src, Integer.MAX_VALUE, (path, attr) -> path.toString().endsWith(".java"))