From c4611d669db5ef38ba59540dc850cb59a5168348 Mon Sep 17 00:00:00 2001 From: Reinier Zwitserloot Date: Sat, 27 Jun 2009 03:56:33 +0200 Subject: [BUGFIX] For some reason, JCLiteral objects contain '1' or '0' (integers) for booleans, not actual booleans. You can tell the difference via the getKind() method. hence, boolean fields in annotations were throwing unexpected type errors (Integer instead of Boolean). Fixed this. --- src/lombok/javac/Javac.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lombok/javac/Javac.java b/src/lombok/javac/Javac.java index 801e7a23..90448e26 100644 --- a/src/lombok/javac/Javac.java +++ b/src/lombok/javac/Javac.java @@ -88,7 +88,11 @@ public class Javac { private static Object calculateGuess(JCExpression expr) { if ( expr instanceof JCLiteral ) { - return ((JCLiteral)expr).value; + JCLiteral lit = (JCLiteral)expr; + if ( lit.getKind() == com.sun.source.tree.Tree.Kind.BOOLEAN_LITERAL ) { + return ((Number)lit.value).intValue() == 0 ? false : true; + } + return lit.value; } else if ( expr instanceof JCIdent || expr instanceof JCFieldAccess ) { String x = expr.toString(); if ( x.endsWith(".class") ) x = x.substring(0, x.length() - 6); -- cgit