mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 16:17:34 +00:00
[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.
This commit is contained in:
1 parent
18931bec53
commit
c4611d669d
1 file changed
+5
-1
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user