mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 23:04:50 +02:00
8142968: Module System implementation
Initial integration of JEP 200, JEP 260, JEP 261, and JEP 282 Co-authored-by: Alex Buckley <alex.buckley@oracle.com> Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com> Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com> Co-authored-by: Mandy Chung <mandy.chung@oracle.com> Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com> Co-authored-by: Jan Lahoda <jan.lahoda@oracle.com> Co-authored-by: Vicente Romero <vicente.romero@oracle.com> Co-authored-by: Andreas Lundblad <andreas.lundblad@oracle.com> Co-authored-by: Andrey Nazarov <andrey.x.nazarov@oracle.com> Co-authored-by: Chris Hegarty <chris.hegarty@oracle.com> Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com> Co-authored-by: Kumar Srinivasan <kumar.x.srinivasan@oracle.com> Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com> Reviewed-by: jjg, jlahoda, vromero, mcimadamore, bpatel, ksrini, darcy, anazarov, dfuchs
This commit is contained in:
parent
8cffe4fb02
commit
001ebb3a72
879 changed files with 26184 additions and 9697 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -21,6 +21,8 @@
|
|||
* questions.
|
||||
*/
|
||||
|
||||
import java.lang.reflect.Layer;
|
||||
import java.lang.reflect.Module;
|
||||
import java.util.*;
|
||||
import javax.annotation.processing.*;
|
||||
import javax.lang.model.SourceVersion;
|
||||
|
@ -97,6 +99,20 @@ public abstract class JavacTestingAbstractProcessor extends AbstractProcessor {
|
|||
options = processingEnv.getOptions();
|
||||
}
|
||||
|
||||
protected void addExports(String moduleName, String... packageNames) {
|
||||
for (String packageName : packageNames) {
|
||||
try {
|
||||
Layer layer = Layer.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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The set of visitors below will directly extend the most recent
|
||||
* corresponding platform visitor type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue