< prev index next >

test/langtools/tools/javac/lib/JavacTestingAbstractProcessor.java

Print this page
*** 96,14 ***
  
      protected void addExports(String moduleName, String... packageNames) {
          for (String packageName : packageNames) {
              try {
                  ModuleLayer layer = ModuleLayer.boot();
!                 Optional<Module> m = layer.findModule(moduleName);
!                 if (!m.isPresent())
                      throw new Error("module not found: " + moduleName);
!                 m.get().addExports(packageName, getClass().getModule());
              } catch (Exception e) {
                  throw new Error("failed to add exports for " + moduleName + "/" + packageName);
              }
          }
      }
--- 96,15 ---
  
      protected void addExports(String moduleName, String... packageNames) {
          for (String packageName : packageNames) {
              try {
                  ModuleLayer layer = ModuleLayer.boot();
!                 // removing dependency on java.util.Optional, valhalla only, to avoid VM warnings
!                 Module m = layer.findModule(moduleName).get();
+                 if (m == null)
                      throw new Error("module not found: " + moduleName);
!                 m.addExports(packageName, getClass().getModule());
              } catch (Exception e) {
                  throw new Error("failed to add exports for " + moduleName + "/" + packageName);
              }
          }
      }
< prev index next >