81 if (sat != null)
82 return super.getSupportedAnnotationTypes();
83 else
84 return allAnnotations;
85 }
86
87 @Override
88 public void init(ProcessingEnvironment processingEnv) {
89 super.init(processingEnv);
90 elements = eltUtils = processingEnv.getElementUtils();
91 types = typeUtils = processingEnv.getTypeUtils();
92 filer = processingEnv.getFiler();
93 messager = processingEnv.getMessager();
94 options = processingEnv.getOptions();
95 }
96
97 protected void addExports(String moduleName, String... packageNames) {
98 for (String packageName : packageNames) {
99 try {
100 ModuleLayer layer = ModuleLayer.boot();
101 Optional<Module> m = layer.findModule(moduleName);
102 if (!m.isPresent())
103 throw new Error("module not found: " + moduleName);
104 m.get().addExports(packageName, getClass().getModule());
105 } catch (Exception e) {
106 throw new Error("failed to add exports for " + moduleName + "/" + packageName);
107 }
108 }
109 }
110
111 /*
112 * The set of visitors below will directly extend the most recent
113 * corresponding platform visitor type.
114 */
115
116 @SupportedSourceVersion(RELEASE_23)
117 public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor14<R, P> {
118
119 /**
120 * Constructor for concrete subclasses to call.
121 */
122 protected AbstractAnnotationValueVisitor() {
123 super();
124 }
|
81 if (sat != null)
82 return super.getSupportedAnnotationTypes();
83 else
84 return allAnnotations;
85 }
86
87 @Override
88 public void init(ProcessingEnvironment processingEnv) {
89 super.init(processingEnv);
90 elements = eltUtils = processingEnv.getElementUtils();
91 types = typeUtils = processingEnv.getTypeUtils();
92 filer = processingEnv.getFiler();
93 messager = processingEnv.getMessager();
94 options = processingEnv.getOptions();
95 }
96
97 protected void addExports(String moduleName, String... packageNames) {
98 for (String packageName : packageNames) {
99 try {
100 ModuleLayer layer = ModuleLayer.boot();
101 // removing dependency on java.util.Optional, valhalla only, to avoid VM warnings
102 Module m = layer.findModule(moduleName).get();
103 if (m == null)
104 throw new Error("module not found: " + moduleName);
105 m.addExports(packageName, getClass().getModule());
106 } catch (Exception e) {
107 throw new Error("failed to add exports for " + moduleName + "/" + packageName);
108 }
109 }
110 }
111
112 /*
113 * The set of visitors below will directly extend the most recent
114 * corresponding platform visitor type.
115 */
116
117 @SupportedSourceVersion(RELEASE_23)
118 public static abstract class AbstractAnnotationValueVisitor<R, P> extends AbstractAnnotationValueVisitor14<R, P> {
119
120 /**
121 * Constructor for concrete subclasses to call.
122 */
123 protected AbstractAnnotationValueVisitor() {
124 super();
125 }
|