diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-10-27 22:32:44 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2013-10-27 22:32:44 +0100 |
commit | 5cdb0757d39d100c76bbca63734fb83b4cb13753 (patch) | |
tree | 0262ce9f265201d27e6d1a110964fafca1c5b9bd | |
parent | 601cd66babeaec0963b8cadf2190fd48708d0d33 (diff) | |
download | lombok-5cdb0757d39d100c76bbca63734fb83b4cb13753.tar.gz lombok-5cdb0757d39d100c76bbca63734fb83b4cb13753.tar.bz2 lombok-5cdb0757d39d100c76bbca63734fb83b4cb13753.zip |
[issue 598] JDK8 update broke assignment-with-operator in delombok.
5 files changed, 162 insertions, 3 deletions
diff --git a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java index 67c313ab..f9152e68 100644 --- a/src/delombok/lombok/delombok/PrettyCommentsPrinter.java +++ b/src/delombok/lombok/delombok/PrettyCommentsPrinter.java @@ -158,6 +158,18 @@ public class PrettyCommentsPrinter extends JCTree.Visitor { map.put(treeTag("DIV"), "/"); map.put(treeTag("MOD"), "%"); + map.put(treeTag("BITOR_ASG"), "|="); + map.put(treeTag("BITXOR_ASG"), "^="); + map.put(treeTag("BITAND_ASG"), "&="); + map.put(treeTag("SL_ASG"), "<<="); + map.put(treeTag("SR_ASG"), ">>="); + map.put(treeTag("USR_ASG"), ">>>="); + map.put(treeTag("PLUS_ASG"), "+="); + map.put(treeTag("MINUS_ASG"), "-="); + map.put(treeTag("MUL_ASG"), "*="); + map.put(treeTag("DIV_ASG"), "/="); + map.put(treeTag("MOD_ASG"), "%="); + OPERATORS = map; } @@ -1234,8 +1246,8 @@ public class PrettyCommentsPrinter extends JCTree.Visitor { try { open(prec, TreeInfo.assignopPrec); printExpr(tree.lhs, TreeInfo.assignopPrec + 1); -// print(" " + operatorName(getTag(tree) - JCTree.ASGOffset) + "= "); - print(" = "); + String opname = operatorName(treeTag(tree)); + print(" " + opname + " "); printExpr(tree.rhs, TreeInfo.assignopPrec); close(prec, TreeInfo.assignopPrec); } catch (IOException e) { diff --git a/test/transform/resource/after-delombok/TestOperators.java b/test/transform/resource/after-delombok/TestOperators.java new file mode 100644 index 00000000..566bedfc --- /dev/null +++ b/test/transform/resource/after-delombok/TestOperators.java @@ -0,0 +1,48 @@ +class TestOperators { + int x = 10; + public void test() { + x = 12; + int a = +x; + boolean d = true; + boolean e = false; + boolean b; + a = -x; + b = !d; + a = ~x; + a = ++x; + a = --x; + a = x++; + a = x--; + b = d || e; + b = d && e; + a = x | a; + a = x ^ a; + a = x & a; + b = a == x; + b = a != x; + b = a < x; + b = a > x; + b = a <= x; + b = a >= x; + a = a << x; + a = a >> x; + a = a >>> x; + a = a + x; + a = a - x; + a = a * x; + a = a / x; + a = a % x; + a |= x; + a ^= x; + a &= x; + a <<= x; + a >>= x; + a >>>= x; + a += x; + a -= x; + a *= x; + a /= x; + a %= x; + a = a > x ? 1 : 0; + } +} diff --git a/test/transform/resource/after-ecj/TestOperators.java b/test/transform/resource/after-ecj/TestOperators.java new file mode 100644 index 00000000..8a78ceeb --- /dev/null +++ b/test/transform/resource/after-ecj/TestOperators.java @@ -0,0 +1,51 @@ +class TestOperators { + int x = 10; + TestOperators() { + super(); + } + public void test() { + x = 12; + int a = (+ x); + boolean d = true; + boolean e = false; + boolean b; + a = (- x); + b = (! d); + a = (~ x); + a = (++ x); + a = (-- x); + a = (x ++); + a = (x --); + b = (d || e); + b = (d && e); + a = (x | a); + a = (x ^ a); + a = (x & a); + b = (a == x); + b = (a != x); + b = (a < x); + b = (a > x); + b = (a <= x); + b = (a >= x); + a = (a << x); + a = (a >> x); + a = (a >>> x); + a = (a + x); + a = (a - x); + a = (a * x); + a = (a / x); + a = (a % x); + a |= x; + a ^= x; + a &= x; + a <<= x; + a >>= x; + a >>>= x; + a += x; + a -= x; + a *= x; + a /= x; + a %= x; + a = ((a > x) ? 1 : 0); + } +} diff --git a/test/transform/resource/before/TestOperators.java b/test/transform/resource/before/TestOperators.java new file mode 100644 index 00000000..566bedfc --- /dev/null +++ b/test/transform/resource/before/TestOperators.java @@ -0,0 +1,48 @@ +class TestOperators { + int x = 10; + public void test() { + x = 12; + int a = +x; + boolean d = true; + boolean e = false; + boolean b; + a = -x; + b = !d; + a = ~x; + a = ++x; + a = --x; + a = x++; + a = x--; + b = d || e; + b = d && e; + a = x | a; + a = x ^ a; + a = x & a; + b = a == x; + b = a != x; + b = a < x; + b = a > x; + b = a <= x; + b = a >= x; + a = a << x; + a = a >> x; + a = a >>> x; + a = a + x; + a = a - x; + a = a * x; + a = a / x; + a = a % x; + a |= x; + a ^= x; + a &= x; + a <<= x; + a >>= x; + a >>>= x; + a += x; + a -= x; + a *= x; + a /= x; + a %= x; + a = a > x ? 1 : 0; + } +} diff --git a/website/features/experimental/index.html b/website/features/experimental/index.html index 16d58050..1128787c 100644 --- a/website/features/experimental/index.html +++ b/website/features/experimental/index.html @@ -32,7 +32,7 @@ <dd>New default field modifiers for the 21st century.</dd> <dt><a href="Wither.html"><code>@Wither</code></a></dt> <dd>Immutable 'setters' - methods that create a clone but with one changed field.</dd> - <dt><a href="onX.html"><code>onMethod= / onConstructor= / onParam</code></a></dt> + <dt><a href="onX.html"><code>onMethod= / onConstructor= / onParam=</code></a></dt> <dd>Sup dawg, we heard you like annotations, so we put annotations in your annotations so you can annotate while you're annotating.</dd> </dl> </div> |