From ccfab5ebffbd14df59689b23ff6f3df52890dca8 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Tue, 8 Jan 2019 03:33:24 +0100 Subject: [#1033] steps on the way to issue 1033: You can add cleanup tasks which are deferred (during the javac run) until the end. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/core/lombok/javac/apt/LombokProcessor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/core/lombok/javac/apt') 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 roots = new IdentityHashMap(); private long[] priorityLevels; private Set priorityLevelsRequiringResolutionReset; + private CleanupRegistry cleanup = new CleanupRegistry(); /** {@inheritDoc} */ @Override public boolean process(Set 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. -- cgit