aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2015-02-01 06:52:52 +0100
committerReinier Zwitserloot <reinier@zwitserloot.com>2015-02-01 06:53:10 +0100
commite5860edabe31f3b6ceabd91f9cbcadf3d4d0315a (patch)
treeb1d52306c826f384aed0ff9228029feb3f0ff88d /test
parenta6170f5298daf42931877a2d9c98e6f2ad1985be (diff)
downloadlombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.tar.gz
lombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.tar.bz2
lombok-e5860edabe31f3b6ceabd91f9cbcadf3d4d0315a.zip
Fixed issues with val in inner classes, and re-enabled a test that caught it that we ignored earlier.
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/LombokTestSource.java2
-rw-r--r--test/transform/resource/after-delombok/ValAnonymousSubclassWithGenerics.java18
-rw-r--r--test/transform/resource/after-ecj/ValAnonymousSubclassWithGenerics.java28
-rw-r--r--test/transform/resource/before/ValAnonymousSubclassWithGenerics.java2
-rw-r--r--test/transform/resource/before/ValWithLocalClasses.java1
-rw-r--r--test/transform/resource/messages-ecj/ValAnonymousSubclassWithGenerics.java.messages1
6 files changed, 51 insertions, 1 deletions
diff --git a/test/core/src/lombok/LombokTestSource.java b/test/core/src/lombok/LombokTestSource.java
index 9b5607ef..c686bf19 100644
--- a/test/core/src/lombok/LombokTestSource.java
+++ b/test/core/src/lombok/LombokTestSource.java
@@ -183,6 +183,8 @@ public class LombokTestSource {
continue;
}
+ if (lc.startsWith("issue ")) continue;
+
Assert.fail("Directive line \"" + directive + "\" in '" + file.getAbsolutePath() + "' invalid: unrecognized directive.");
throw new RuntimeException();
}
diff --git a/test/transform/resource/after-delombok/ValAnonymousSubclassWithGenerics.java b/test/transform/resource/after-delombok/ValAnonymousSubclassWithGenerics.java
new file mode 100644
index 00000000..25a9e0ce
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValAnonymousSubclassWithGenerics.java
@@ -0,0 +1,18 @@
+import java.util.*;
+public class ValAnonymousSubclassWithGenerics {
+ Object object = new Object(){
+ void foo() {
+ final int j = 1;
+ }
+ };
+ void bar() {
+ final int k = super.hashCode();
+ int x = k;
+ }
+ java.util.List<String> names = new java.util.ArrayList<String>(){
+ public String get(int i) {
+ final java.lang.String result = super.get(i);
+ return result;
+ }
+ };
+}
diff --git a/test/transform/resource/after-ecj/ValAnonymousSubclassWithGenerics.java b/test/transform/resource/after-ecj/ValAnonymousSubclassWithGenerics.java
new file mode 100644
index 00000000..989555fc
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValAnonymousSubclassWithGenerics.java
@@ -0,0 +1,28 @@
+import java.util.*;
+import lombok.val;
+public class ValAnonymousSubclassWithGenerics {
+ Object object = new Object() {
+ x() {
+ super();
+ }
+ void foo() {
+ final @val int j = 1;
+ }
+ };
+ java.util.List<String> names = new java.util.ArrayList<String>() {
+ x() {
+ super();
+ }
+ public String get(int i) {
+ final @val java.lang.String result = super.get(i);
+ return result;
+ }
+ };
+ public ValAnonymousSubclassWithGenerics() {
+ super();
+ }
+ void bar() {
+ final @val int k = super.hashCode();
+ int x = k;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java b/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
index 49fc86e0..c0f8157a 100644
--- a/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
+++ b/test/transform/resource/before/ValAnonymousSubclassWithGenerics.java
@@ -1,4 +1,4 @@
-// ignore
+// issue 205: val inside anonymous inner classes is a bit tricky in javac, this test ensures we don't break it.
import java.util.*;
import lombok.val;
diff --git a/test/transform/resource/before/ValWithLocalClasses.java b/test/transform/resource/before/ValWithLocalClasses.java
index 8c6be4f9..572a1e7d 100644
--- a/test/transform/resource/before/ValWithLocalClasses.java
+++ b/test/transform/resource/before/ValWithLocalClasses.java
@@ -1,3 +1,4 @@
+//issue 694: In javac, resolving the RHS (which is what val does) can cause an entire class to be resolved, breaking all usage of val inside that class. This tests that we handle that better.
class ValWithLocalClasses1 {
{
lombok.val f2 = new ValWithLocalClasses2() {};
diff --git a/test/transform/resource/messages-ecj/ValAnonymousSubclassWithGenerics.java.messages b/test/transform/resource/messages-ecj/ValAnonymousSubclassWithGenerics.java.messages
new file mode 100644
index 00000000..37f87639
--- /dev/null
+++ b/test/transform/resource/messages-ecj/ValAnonymousSubclassWithGenerics.java.messages
@@ -0,0 +1 @@
+17 The serializable class does not declare a static final serialVersionUID field of type long \ No newline at end of file