diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2019-01-08 03:33:24 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2019-01-08 03:33:52 +0100 |
commit | ccfab5ebffbd14df59689b23ff6f3df52890dca8 (patch) | |
tree | 3022d684cae61f0fdb2d59856d72b677f0721a02 /src/core/lombok/javac/apt | |
parent | 20df86149d3fe45a82d9b83e33b801f5dc7c34ca (diff) | |
download | lombok-ccfab5ebffbd14df59689b23ff6f3df52890dca8.tar.gz lombok-ccfab5ebffbd14df59689b23ff6f3df52890dca8.tar.bz2 lombok-ccfab5ebffbd14df59689b23ff6f3df52890dca8.zip |
[#1033] steps on the way to issue 1033: You can add cleanup tasks which are deferred (during the javac run) until the end.
This already fixes the exotic-to-the-point-of-nonexistent bug where setter and wither compete to steal the `@param` off of the field’s javadoc. Next are to fix builder and setter/wither competing whilst bringing javadocs to `@Builder`.
Then for various other conflicts, we should defer removal of lombok imports and annotations until the end too.
Diffstat (limited to 'src/core/lombok/javac/apt')
-rw-r--r-- | src/core/lombok/javac/apt/LombokProcessor.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/lombok/javac/apt/LombokProcessor.java b/src/core/lombok/javac/apt/LombokProcessor.java index a3d1dfcf..d4f3504a 100644 --- a/src/core/lombok/javac/apt/LombokProcessor.java +++ b/src/core/lombok/javac/apt/LombokProcessor.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2018 The Project Lombok Authors. + * Copyright (C) 2009-2019 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 @@ -50,6 +50,7 @@ import javax.tools.JavaFileManager; import javax.tools.JavaFileObject; import lombok.Lombok; +import lombok.core.CleanupRegistry; import lombok.core.DiagnosticsReceiver; import lombok.javac.JavacTransformer; import lombok.permit.Permit; @@ -288,11 +289,15 @@ public class LombokProcessor extends AbstractProcessor { private final IdentityHashMap<JCCompilationUnit, Long> roots = new IdentityHashMap<JCCompilationUnit, Long>(); private long[] priorityLevels; private Set<Long> priorityLevelsRequiringResolutionReset; + private CleanupRegistry cleanup = new CleanupRegistry(); /** {@inheritDoc} */ @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { if (lombokDisabled) return false; - if (roundEnv.processingOver()) return false; + if (roundEnv.processingOver()) { + cleanup.run(); + return false; + } // We have: A sorted set of all priority levels: 'priorityLevels' @@ -318,7 +323,7 @@ public class LombokProcessor extends AbstractProcessor { if (prioOfCu == null || prioOfCu != prio) continue; cusForThisRound.add(entry.getKey()); } - transformer.transform(prio, javacProcessingEnv.getContext(), cusForThisRound); + transformer.transform(prio, javacProcessingEnv.getContext(), cusForThisRound, cleanup); } // Step 3: Push up all CUs to the next level. Set level to null if there is no next level. |