< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.test/src/org/graalvm/compiler/test/JLModule.java

Print this page




  79             throw new AssertionError(e);
  80         }
  81     }
  82 
  83     /**
  84      * Exports all packages in this module to a given module.
  85      */
  86     public void exportAllPackagesTo(JLModule module) {
  87         if (this != module) {
  88             for (String pkg : getPackages()) {
  89                 // Export all JVMCI packages dynamically instead
  90                 // of requiring a long list of -XaddExports
  91                 // options on the JVM command line.
  92                 if (!isExported(pkg, module)) {
  93                     addExports(pkg, module);
  94                 }
  95             }
  96         }
  97     }
  98 

  99     public Set<String> getPackages() {
 100         try {
 101             return (Set<String>) getPackagesMethod.invoke(realModule);
 102         } catch (Exception e) {
 103             throw new AssertionError(e);
 104         }
 105     }
 106 
 107     public boolean isExported(String pn) {
 108         try {
 109             return (Boolean) isExportedMethod.invoke(realModule, pn);
 110         } catch (Exception e) {
 111             throw new AssertionError(e);
 112         }
 113     }
 114 
 115     public boolean isExported(String pn, JLModule other) {
 116         try {
 117             return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
 118         } catch (Exception e) {


  79             throw new AssertionError(e);
  80         }
  81     }
  82 
  83     /**
  84      * Exports all packages in this module to a given module.
  85      */
  86     public void exportAllPackagesTo(JLModule module) {
  87         if (this != module) {
  88             for (String pkg : getPackages()) {
  89                 // Export all JVMCI packages dynamically instead
  90                 // of requiring a long list of -XaddExports
  91                 // options on the JVM command line.
  92                 if (!isExported(pkg, module)) {
  93                     addExports(pkg, module);
  94                 }
  95             }
  96         }
  97     }
  98 
  99     @SuppressWarnings("unchecked")
 100     public Set<String> getPackages() {
 101         try {
 102             return (Set<String>) getPackagesMethod.invoke(realModule);
 103         } catch (Exception e) {
 104             throw new AssertionError(e);
 105         }
 106     }
 107 
 108     public boolean isExported(String pn) {
 109         try {
 110             return (Boolean) isExportedMethod.invoke(realModule, pn);
 111         } catch (Exception e) {
 112             throw new AssertionError(e);
 113         }
 114     }
 115 
 116     public boolean isExported(String pn, JLModule other) {
 117         try {
 118             return (Boolean) isExported2Method.invoke(realModule, pn, other.realModule);
 119         } catch (Exception e) {
< prev index next >