aboutsummaryrefslogtreecommitdiff
path: root/src/bindings/mapstruct/lombok
diff options
context:
space:
mode:
Diffstat (limited to 'src/bindings/mapstruct/lombok')
-rw-r--r--src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java35
1 files changed, 35 insertions, 0 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;
+ }
+ }
+}