test/jdk/jdk/modules/etc/JdkQualifiedExportTest.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File open Sdiff test/jdk/jdk/modules/etc

test/jdk/jdk/modules/etc/JdkQualifiedExportTest.java

Print this page


   1 /*
   2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  54         ModuleFinder.ofSystem().findAll()
  55                     .stream()
  56                     .map(ModuleReference::descriptor)
  57                     .sorted(Comparator.comparing(ModuleDescriptor::name))
  58                     .forEach(JdkQualifiedExportTest::check);
  59     }
  60 
  61     static void check(ModuleDescriptor md) {
  62         // skip checking if this is an upgradeable module
  63         if (!HashedModules.contains(md.name())) {
  64             return;
  65         }
  66 
  67         checkExports(md);
  68         checkOpens(md);
  69     }
  70 
  71     static Set<String> KNOWN_EXCEPTIONS =
  72         Set.of("jdk.internal.vm.ci/jdk.vm.ci.services",
  73                "jdk.internal.vm.ci/jdk.vm.ci.runtime",



  74                "jdk.jsobject/jdk.internal.netscape.javascript.spi");
  75 
  76     static void checkExports(ModuleDescriptor md) {
  77         // build a map of upgradeable module to Exports that are qualified to it
  78         // skip the qualified exports
  79         Map<String, Set<Exports>> targetToExports = new HashMap<>();
  80         md.exports().stream()
  81           .filter(Exports::isQualified)
  82           .forEach(e -> e.targets().stream()
  83                          .filter(mn -> accept(md, mn))
  84                          .forEach(t -> targetToExports.computeIfAbsent(t, _k -> new HashSet<>())
  85                                                       .add(e)));
  86 
  87         if (targetToExports.size() > 0) {
  88             String mn = md.name();
  89 
  90             System.err.println(mn);
  91             targetToExports.entrySet().stream()
  92                 .sorted(Map.Entry.comparingByKey())
  93                 .forEach(e -> {


   1 /*
   2  * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  54         ModuleFinder.ofSystem().findAll()
  55                     .stream()
  56                     .map(ModuleReference::descriptor)
  57                     .sorted(Comparator.comparing(ModuleDescriptor::name))
  58                     .forEach(JdkQualifiedExportTest::check);
  59     }
  60 
  61     static void check(ModuleDescriptor md) {
  62         // skip checking if this is an upgradeable module
  63         if (!HashedModules.contains(md.name())) {
  64             return;
  65         }
  66 
  67         checkExports(md);
  68         checkOpens(md);
  69     }
  70 
  71     static Set<String> KNOWN_EXCEPTIONS =
  72         Set.of("jdk.internal.vm.ci/jdk.vm.ci.services",
  73                "jdk.internal.vm.ci/jdk.vm.ci.runtime",
  74                "jdk.internal.vm.ci/jdk.vm.ci.hotspot",
  75                "jdk.internal.vm.ci/jdk.vm.ci.meta",
  76                "jdk.internal.vm.ci/jdk.vm.ci.code",
  77                "jdk.jsobject/jdk.internal.netscape.javascript.spi");
  78 
  79     static void checkExports(ModuleDescriptor md) {
  80         // build a map of upgradeable module to Exports that are qualified to it
  81         // skip the qualified exports
  82         Map<String, Set<Exports>> targetToExports = new HashMap<>();
  83         md.exports().stream()
  84           .filter(Exports::isQualified)
  85           .forEach(e -> e.targets().stream()
  86                          .filter(mn -> accept(md, mn))
  87                          .forEach(t -> targetToExports.computeIfAbsent(t, _k -> new HashSet<>())
  88                                                       .add(e)));
  89 
  90         if (targetToExports.size() > 0) {
  91             String mn = md.name();
  92 
  93             System.err.println(mn);
  94             targetToExports.entrySet().stream()
  95                 .sorted(Map.Entry.comparingByKey())
  96                 .forEach(e -> {


test/jdk/jdk/modules/etc/JdkQualifiedExportTest.java
Index Unified diffs Context diffs Sdiffs Wdiffs Patch New Old Previous File Next File