diff options
author | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-04-24 14:12:28 +0200 |
---|---|---|
committer | Reinier Zwitserloot <r.zwitserloot@projectlombok.org> | 2019-04-24 14:12:28 +0200 |
commit | 150be0a186d880503cb23d056ea4cf229ebc37e5 (patch) | |
tree | d522af446bf8cb6464517fa04386b5a5b9fad9dd /src/utils/lombok/javac | |
parent | ac871308f12e480427e655388385b5fd00f52032 (diff) | |
download | lombok-150be0a186d880503cb23d056ea4cf229ebc37e5.tar.gz lombok-150be0a186d880503cb23d056ea4cf229ebc37e5.tar.bz2 lombok-150be0a186d880503cb23d056ea4cf229ebc37e5.zip |
[trivial] adding a comment to give context to the fix for delombok being overly liberal with applying "var" to things.
Diffstat (limited to 'src/utils/lombok/javac')
-rw-r--r-- | src/utils/lombok/javac/JavacTreeMaker.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/utils/lombok/javac/JavacTreeMaker.java b/src/utils/lombok/javac/JavacTreeMaker.java index 81278de2..84293f11 100644 --- a/src/utils/lombok/javac/JavacTreeMaker.java +++ b/src/utils/lombok/javac/JavacTreeMaker.java @@ -442,6 +442,8 @@ public class JavacTreeMaker { private static final MethodId<JCVariableDecl> VarDef = MethodId("VarDef"); public JCVariableDecl VarDef(JCModifiers mods, Name name, JCExpression vartype, JCExpression init) { JCVariableDecl varDef = invoke(VarDef, mods, name, vartype, init); + // We use 'position of the type is -1' as indicator in delombok that the original node was written using JDK10's 'var' feature, because javac desugars 'var' to the real type and doesn't leave any markers other than the + // node position to indicate that it did so. Unfortunately, that means vardecls we generate look like 'var' to delombok. Adjust the position to avoid this. if (varDef.vartype != null && varDef.vartype.pos == -1) varDef.vartype.pos = 0; return varDef; } |