[issue 598] JDK8 update broke assignment-with-operator in delombok.

This commit is contained in:
Reinier Zwitserloot committed 2013-10-27 22:32:44 +01:00
1 parent 601cd66bab
commit 5cdb0757d3
5 files changed
+162 -3

No files matched your search

@@ -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) {
@@ -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;
}
}
@@ -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);
}
}
@@ -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;
}
}
+1 -1
View File
@@ -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>