diff options
author | Roel Spilker <r.spilker@gmail.com> | 2020-02-14 00:06:52 +0100 |
---|---|---|
committer | Roel Spilker <r.spilker@gmail.com> | 2020-02-14 00:07:45 +0100 |
commit | 0d7540db0cc0c9a2758799522925f09eddeb7420 (patch) | |
tree | 10f7b31859ebe9ed670b04ff4007406e5de3dd7a /src/bindings/mapstruct/lombok | |
parent | a8dd99d9f080be6839fe507ade104fccac115de4 (diff) | |
download | lombok-0d7540db0cc0c9a2758799522925f09eddeb7420.tar.gz lombok-0d7540db0cc0c9a2758799522925f09eddeb7420.tar.bz2 lombok-0d7540db0cc0c9a2758799522925f09eddeb7420.zip |
(#2125) Extract mapstruct binding to separate module.
Diffstat (limited to 'src/bindings/mapstruct/lombok')
-rw-r--r-- | src/bindings/mapstruct/lombok/mapstruct/NotifierHider.java | 35 |
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; + } + } +} |