aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@tipit.to>2009-06-27 03:56:33 +0200
committerReinier Zwitserloot <reinier@tipit.to>2009-06-27 03:56:33 +0200
commitc4611d669db5ef38ba59540dc850cb59a5168348 (patch)
tree2dc02fa8e6fed014657e4652b32805c7b36178e2
parent18931bec5315db308e369a05918af54e59ebd8b6 (diff)
downloadlombok-c4611d669db5ef38ba59540dc850cb59a5168348.tar.gz
lombok-c4611d669db5ef38ba59540dc850cb59a5168348.tar.bz2
lombok-c4611d669db5ef38ba59540dc850cb59a5168348.zip
[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.
-rw-r--r--src/lombok/javac/Javac.java6
1 files changed, 5 insertions, 1 deletions
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);