aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java35
-rw-r--r--src/bindings/mapstruct/module-info.java29
-rw-r--r--src/core9/module-info.java4
-rw-r--r--src/j9stubs/mapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java (renamed from src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java)0
-rw-r--r--src/launch/lombok/launch/AnnotationProcessor.java15
5 files changed, 69 insertions, 14 deletions
diff --git a/src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java b/src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java
new file mode 100644
index 00000000..a8e92b4b
--- /dev/null
+++ b/src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java
@@ -0,0 +1,35 @@
+package lombok.mapstruct;
+
+import java.lang.reflect.Field;
+
+import javax.lang.model.type.TypeMirror;
+
+import org.mapstruct.ap.spi.AstModifyingAnnotationProcessor;
+
+class NotifierHider {
+
+ public static class AstModificationNotifier implements AstModifyingAnnotationProcessor {
+ private static Field lombokInvoked;
+
+ @Override public boolean isTypeComplete(TypeMirror type) {
+ if (System.getProperty("lombok.disable") != null) return true;
+ return isLombokInvoked();
+ }
+
+ private static boolean isLombokInvoked() {
+ if (lombokInvoked != null) {
+ try {
+ return lombokInvoked.getBoolean(null);
+ } catch (Exception e) {}
+ return true;
+ }
+
+ try {
+ Class<?> data = Class.forName("lombok.launch.AnnotationProcessorHider$AstModificationNotifierData");
+ lombokInvoked = data.getField("lombokInvoked");
+ return lombokInvoked.getBoolean(null);
+ } catch (Exception e) {}
+ return true;
+ }
+ }
+}
diff --git a/src/bindings/mapstruct/module-info.java b/src/bindings/mapstruct/module-info.java
new file mode 100644
index 00000000..bbfbd823
--- /dev/null
+++ b/src/bindings/mapstruct/module-info.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 The Project Lombok Authors.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+module lombok.mapstruct {
+ requires lombok;
+ requires java.compiler;
+
+ requires static org.mapstruct.processor;
+
+ provides org.mapstruct.ap.spi.AstModifyingAnnotationProcessor with lombok.mapstruct.NotifierHider.AstModificationNotifier;
+}
diff --git a/src/core9/module-info.java b/src/core9/module-info.java
index 56e54270..293bc839 100644
--- a/src/core9/module-info.java
+++ b/src/core9/module-info.java
@@ -23,7 +23,6 @@ module lombok {
requires java.compiler;
requires java.instrument;
requires jdk.unsupported;
- requires static org.mapstruct.processor;
exports lombok;
exports lombok.experimental;
@@ -34,6 +33,7 @@ module lombok {
exports lombok.extern.slf4j;
exports lombok.extern.flogger;
+ exports lombok.launch to lombok.mapstruct;
+
provides javax.annotation.processing.Processor with lombok.launch.AnnotationProcessorHider.AnnotationProcessor;
- provides org.mapstruct.ap.spi.AstModifyingAnnotationProcessor with lombok.launch.AnnotationProcessorHider.AstModificationNotifier;
}
diff --git a/src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java b/src/j9stubs/mapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java
index ffb99030..ffb99030 100644
--- a/src/j9stubs/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java
+++ b/src/j9stubs/mapstruct/org/mapstruct/ap/spi/AstModifyingAnnotationProcessor.java
diff --git a/src/launch/lombok/launch/AnnotationProcessor.java b/src/launch/lombok/launch/AnnotationProcessor.java
index b03dec76..456a8cef 100644
--- a/src/launch/lombok/launch/AnnotationProcessor.java
+++ b/src/launch/lombok/launch/AnnotationProcessor.java
@@ -34,22 +34,13 @@ import javax.lang.model.element.AnnotationMirror;
import javax.lang.model.element.Element;
import javax.lang.model.element.ExecutableElement;
import javax.lang.model.element.TypeElement;
-import javax.lang.model.type.TypeMirror;
-
-import org.mapstruct.ap.spi.AstModifyingAnnotationProcessor;
import sun.misc.Unsafe;
class AnnotationProcessorHider {
- public static class AstModificationNotifier implements AstModifyingAnnotationProcessor {
- @Override public boolean isTypeComplete(TypeMirror type) {
- if (System.getProperty("lombok.disable") != null) return true;
- return AstModificationNotifierData.lombokInvoked;
- }
- }
-
- static class AstModificationNotifierData {
- volatile static boolean lombokInvoked = false;
+
+ public static class AstModificationNotifierData {
+ public volatile static boolean lombokInvoked = false;
}
public static class AnnotationProcessor extends AbstractProcessor {