Java Code Examples for java.lang.module.ModuleDescriptor#opens()
The following examples show how to use
java.lang.module.ModuleDescriptor#opens() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SystemModulesPlugin.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
private void dedups(ModuleDescriptor md) { // exports for (Exports e : md.exports()) { dedupSetBuilder.stringSet(e.targets()); dedupSetBuilder.exportsModifiers(e.modifiers()); } // opens for (Opens opens : md.opens()) { dedupSetBuilder.stringSet(opens.targets()); dedupSetBuilder.opensModifiers(opens.modifiers()); } // requires for (Requires r : md.requires()) { dedupSetBuilder.requiresModifiers(r.modifiers()); } // uses dedupSetBuilder.stringSet(md.uses()); }
Example 2
Source File: Main.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
static void checkOpenModule() { ModuleDescriptor md = Foo.class.getModule().getDescriptor(); System.out.println(md); if (!md.isOpen()) { throw new RuntimeException("m4 is a open module"); } if (md.packages().size() != 1 || !md.packages().contains("p4")) { throw new RuntimeException("unexpected m4 packages: " + md.packages()); } if (!md.opens().isEmpty()) { throw new RuntimeException("unexpected m4 opens: " + md.opens()); } }
Example 3
Source File: Loader.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Returns true if the given module opens the given package * unconditionally. * * @implNote This method currently iterates over each of the open * packages. This will be replaced once the ModuleDescriptor.Opens * API is updated. */ private boolean isOpen(ModuleReference mref, String pn) { ModuleDescriptor descriptor = mref.descriptor(); if (descriptor.isOpen() || descriptor.isAutomatic()) return true; for (ModuleDescriptor.Opens opens : descriptor.opens()) { String source = opens.source(); if (!opens.isQualified() && source.equals(pn)) { return true; } } return false; }
Example 4
Source File: BuiltinClassLoader.java From Bytecoder with Apache License 2.0 | 5 votes |
/** * Returns true if the given module opens the given package * unconditionally. * * @implNote This method currently iterates over each of the open * packages. This will be replaced once the ModuleDescriptor.Opens * API is updated. */ private boolean isOpen(ModuleReference mref, String pn) { ModuleDescriptor descriptor = mref.descriptor(); if (descriptor.isOpen() || descriptor.isAutomatic()) return true; for (ModuleDescriptor.Opens opens : descriptor.opens()) { String source = opens.source(); if (!opens.isQualified() && source.equals(pn)) { return true; } } return false; }
Example 5
Source File: Loader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns true if the given module opens the given package * unconditionally. * * @implNote This method currently iterates over each of the open * packages. This will be replaced once the ModuleDescriptor.Opens * API is updated. */ private boolean isOpen(ModuleReference mref, String pn) { ModuleDescriptor descriptor = mref.descriptor(); if (descriptor.isOpen() || descriptor.isAutomatic()) return true; for (ModuleDescriptor.Opens opens : descriptor.opens()) { String source = opens.source(); if (!opens.isQualified() && source.equals(pn)) { return true; } } return false; }
Example 6
Source File: BuiltinClassLoader.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Returns true if the given module opens the given package * unconditionally. * * @implNote This method currently iterates over each of the open * packages. This will be replaced once the ModuleDescriptor.Opens * API is updated. */ private boolean isOpen(ModuleReference mref, String pn) { ModuleDescriptor descriptor = mref.descriptor(); if (descriptor.isOpen() || descriptor.isAutomatic()) return true; for (ModuleDescriptor.Opens opens : descriptor.opens()) { String source = opens.source(); if (!opens.isQualified() && source.equals(pn)) { return true; } } return false; }