From d9572c05b109d82ebe7455fbb16d8fe845bddbe5 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Wed, 21 Jan 2015 01:11:38 +0100 Subject: Fix for erroneous use of val in basic fors. --- src/eclipseAgent/lombok/eclipse/agent/PatchVal.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/eclipseAgent/lombok/eclipse') diff --git a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java index e734dceb..1379719d 100644 --- a/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java +++ b/src/eclipseAgent/lombok/eclipse/agent/PatchVal.java @@ -128,7 +128,9 @@ public class PatchVal { if (!isVal(local.type, scope)) return false; - if (new Throwable().getStackTrace()[2].getClassName().contains("ForStatement")) return false; + StackTraceElement[] st = new Throwable().getStackTrace(); + if (st.length > 2 && st[2].getClassName().contains("ForStatement")) return false; + if (st.length > 8 && st[8].getClassName().contains("ForStatement")) return false; Expression init = local.initialization; if (init == null && Reflection.initCopyField != null) { -- cgit