Updated tests to reflect changes to delombok (delombok now kills super(), because attrib adds them even in places where that's wrong).

Also split up the SynchronizedName test into separate cases for each expected failure mode.
This commit is contained in:
Reinier Zwitserloot committed 2012-07-16 22:04:39 +02:00
1 parent 2502862f89
commit e642150998
14 files changed
+54 -19

No files matched your search

@@ -1037,8 +1037,17 @@ public class PrettyCommentsPrinter extends JCTree.Visitor {
throw new UncheckedIOException(e);
}
}
private boolean isNoArgsSuperCall(JCExpression expr) {
if (!(expr instanceof JCMethodInvocation)) return false;
JCMethodInvocation tree = (JCMethodInvocation) expr;
if (!tree.typeargs.isEmpty() || !tree.args.isEmpty()) return false;
if (!(tree.meth instanceof JCIdent)) return false;
return ((JCIdent) tree.meth).name.toString().equals("super");
}
public void visitExec(JCExpressionStatement tree) {
if (isNoArgsSuperCall(tree.expr)) return;
try {
printExpr(tree.expr);
if (prec == TreeInfo.notExpression) print(";");
@@ -155,7 +155,6 @@ final class Data3 {
final class Data4 extends java.util.Timer {
int x;
Data4() {
super();
}
@java.lang.SuppressWarnings("all")
public int getX() {
@@ -1,6 +1,5 @@
class SneakyThrowsPlain {
SneakyThrowsPlain() {
super();
try {
System.out.println("constructor");
} catch (final java.lang.Throwable $ex) {
@@ -1,19 +1,12 @@
class SynchronizedName {
private Object read = new Object();
private static Object READ = new Object();
void test1() {
synchronized (this.read) {
System.out.println("one");
}
}
void test2() {
System.out.println("two");
}
static void test3() {
synchronized (SynchronizedName.read) {
System.out.println("three");
}
}
void test4() {
synchronized (this.READ) {
System.out.println("four");
@@ -24,4 +17,4 @@ class SynchronizedName {
System.out.println("five");
}
}
}
}
@@ -0,0 +1,7 @@
class SynchronizedNameNoSuchField {
private Object read = new Object();
private static Object READ = new Object();
void test2() {
System.out.println("two");
}
}
@@ -0,0 +1,9 @@
class SynchronizedNameStaticToInstanceRef {
private Object read = new Object();
private static Object READ = new Object();
static void test3() {
synchronized (SynchronizedNameStaticToInstanceRef.read) {
System.out.println("three");
}
}
}
@@ -5,12 +5,6 @@ class SynchronizedName {
@lombok.Synchronized("read") void test1() {
System.out.println("one");
}
@lombok.Synchronized("write") void test2() {
System.out.println("two");
}
@lombok.Synchronized("read") static void test3() {
System.out.println("three");
}
@lombok.Synchronized("READ") void test4() {
System.out.println("four");
}
@@ -0,0 +1,8 @@
class SynchronizedNameNoSuchField {
private Object read = new Object();
private static Object READ = new Object();
@lombok.Synchronized("write") void test2() {
System.out.println("two");
}
}
@@ -0,0 +1,8 @@
class SynchronizedNameStaticToInstanceRef {
private Object read = new Object();
private static Object READ = new Object();
@lombok.Synchronized("read") static void test3() {
System.out.println("three");
}
}
@@ -1 +0,0 @@
8:9 ERROR The field write does not exist.
@@ -0,0 +1 @@
5:9 ERROR The field write does not exist.
@@ -0,0 +1 @@
-1:-1 ERROR non-static variable read cannot be referenced from a static context
@@ -0,0 +1 @@
5:66 ERROR non-static variable read cannot be referenced from a static context
@@ -0,0 +1,7 @@
3:44 ERROR cannot find symbol
symbol : variable d
location: class ValErrors
6:17 ERROR cannot find symbol
symbol : class val
location: class ValErrors
6:25 ERROR illegal initializer for <none>