mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 14:17:48 +00:00
generating fields now occurs in the right place even for enums (no impact; the pretty printer fixes this for delombok and javac doesn’t care, but, still, let’s generate the same structure as what is parsed).
This commit is contained in:
1 parent
cb43dab235
commit
3f0a13501f
1 file changed
+11
-6
@@ -21,6 +21,7 @@
|
||||
*/
|
||||
package lombok.javac.handlers;
|
||||
|
||||
import static com.sun.tools.javac.code.Flags.GENERATEDCONSTR;
|
||||
import static lombok.core.handlers.HandlerUtil.*;
|
||||
import static lombok.javac.Javac.*;
|
||||
import static lombok.javac.JavacAugments.JCTree_generatedNode;
|
||||
@@ -840,14 +841,18 @@ public class JavacHandlerUtil {
|
||||
|
||||
List<JCTree> insertAfter = null;
|
||||
List<JCTree> insertBefore = type.defs;
|
||||
while (insertBefore.tail != null) {
|
||||
while (true) {
|
||||
boolean skip = false;
|
||||
if (insertBefore.head instanceof JCVariableDecl) {
|
||||
JCVariableDecl f = (JCVariableDecl) insertBefore.head;
|
||||
if (isEnumConstant(f) || isGenerated(f)) {
|
||||
insertAfter = insertBefore;
|
||||
insertBefore = insertBefore.tail;
|
||||
continue;
|
||||
}
|
||||
if (isEnumConstant(f) || isGenerated(f)) skip = true;
|
||||
} else if (insertBefore.head instanceof JCMethodDecl) {
|
||||
if ((((JCMethodDecl) insertBefore.head).mods.flags & GENERATEDCONSTR) != 0) skip = true;
|
||||
}
|
||||
if (skip) {
|
||||
insertAfter = insertBefore;
|
||||
insertBefore = insertBefore.tail;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user