From dd0fded2bfbd5c318913209e93d74a2bb06f3d14 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Mon, 29 Nov 2010 20:44:16 +0100 Subject: some more work on why delombok isn't tracking changes due to val alone. --- src/core/lombok/javac/handlers/HandleVal.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/core/lombok/javac/handlers/HandleVal.java b/src/core/lombok/javac/handlers/HandleVal.java index 14b0b44e..63dedc49 100644 --- a/src/core/lombok/javac/handlers/HandleVal.java +++ b/src/core/lombok/javac/handlers/HandleVal.java @@ -68,6 +68,8 @@ public class HandleVal extends JavacASTAdapter { return; } + JavacHandlerUtil.deleteImportFromCompilationUnit(localNode, "lombok.val"); + local.mods.flags |= Flags.FINAL; local.vartype = JavacResolution.createJavaLangObject(localNode.getTreeMaker(), localNode.getAst()); @@ -102,9 +104,10 @@ public class HandleVal extends JavacASTAdapter { if (replacement != null) { local.vartype = replacement; - localNode.getAst().setChanged(); + } else { + local.vartype = JavacResolution.createJavaLangObject(localNode.getTreeMaker(), localNode.getAst());; } - else local.vartype = JavacResolution.createJavaLangObject(localNode.getTreeMaker(), localNode.getAst());; + localNode.getAst().setChanged(); } catch (JavacResolution.TypeNotConvertibleException e) { localNode.addError("Cannot use 'val' here because initializer expression does not have a representable type: " + e.getMessage()); local.vartype = JavacResolution.createJavaLangObject(localNode.getTreeMaker(), localNode.getAst());; -- cgit