aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/core/src/lombok/RunTestsViaEcj.java81
-rw-r--r--test/transform/resource/after-delombok/Constructors.java2
-rw-r--r--test/transform/resource/after-delombok/DataPlain.java6
-rw-r--r--test/transform/resource/after-delombok/DelegateOnGetter.java5
-rw-r--r--test/transform/resource/after-delombok/DelegateOnGetterNone.java2
-rw-r--r--test/transform/resource/after-delombok/GetterAlreadyExists.java6
-rw-r--r--test/transform/resource/after-delombok/GetterLazy.java3
-rw-r--r--test/transform/resource/after-delombok/GetterLazyEahcToString.java3
-rw-r--r--test/transform/resource/after-delombok/GetterLazyNative.java27
-rw-r--r--test/transform/resource/after-delombok/ToStringInner.java8
-rw-r--r--test/transform/resource/after-delombok/ToStringPlain.java4
-rw-r--r--test/transform/resource/after-delombok/ValComplex.java10
-rw-r--r--test/transform/resource/after-delombok/ValInFor.java10
-rw-r--r--test/transform/resource/after-delombok/ValOutersWithGenerics.java21
-rw-r--r--test/transform/resource/after-delombok/ValWeirdTypes.java2
-rw-r--r--test/transform/resource/after-ecj/Constructors.java2
-rw-r--r--test/transform/resource/after-ecj/DataPlain.java5
-rw-r--r--test/transform/resource/after-ecj/DelegateOnGetter.java45
-rw-r--r--test/transform/resource/after-ecj/DelegateOnGetterNone.java20
-rw-r--r--test/transform/resource/after-ecj/DelegateOnMethods.java14
-rw-r--r--test/transform/resource/after-ecj/DelegateTypesAndExcludes.java37
-rw-r--r--test/transform/resource/after-ecj/GetterAlreadyExists.java6
-rw-r--r--test/transform/resource/after-ecj/GetterLazy.java3
-rw-r--r--test/transform/resource/after-ecj/GetterLazyEahcToString.java3
-rw-r--r--test/transform/resource/after-ecj/GetterLazyNative.java27
-rw-r--r--test/transform/resource/after-ecj/SimpleTypeResolution.java2
-rw-r--r--test/transform/resource/after-ecj/ToStringInner.java8
-rw-r--r--test/transform/resource/after-ecj/ToStringPlain.java4
-rw-r--r--test/transform/resource/after-ecj/TrickyTypeResolution.java88
-rw-r--r--test/transform/resource/after-ecj/TrickyTypeResolution2.java15
-rw-r--r--test/transform/resource/after-ecj/ValComplex.java27
-rw-r--r--test/transform/resource/after-ecj/ValErrors.java13
-rw-r--r--test/transform/resource/after-ecj/ValInFor.java15
-rw-r--r--test/transform/resource/after-ecj/ValLessSimple.java40
-rw-r--r--test/transform/resource/after-ecj/ValOutersWithGenerics.java34
-rw-r--r--test/transform/resource/after-ecj/ValSimple.java26
-rw-r--r--test/transform/resource/after-ecj/ValWeirdTypes.java65
-rw-r--r--test/transform/resource/after-ecj/ValWithLabel.java16
-rw-r--r--test/transform/resource/after-eclipse/GetterAlreadyExists.java6
-rw-r--r--test/transform/resource/after-eclipse/ValOutersWithGenerics.java25
-rw-r--r--test/transform/resource/before/Constructors.java2
-rw-r--r--test/transform/resource/before/DataPlain.java2
-rw-r--r--test/transform/resource/before/DelegateOnGetterNone.java2
-rw-r--r--test/transform/resource/before/GetterAlreadyExists.java6
-rw-r--r--test/transform/resource/before/ToStringInner.java8
-rw-r--r--test/transform/resource/before/ToStringPlain.java4
-rw-r--r--test/transform/resource/before/ValComplex.java10
-rw-r--r--test/transform/resource/before/ValInFor.java11
-rw-r--r--test/transform/resource/before/ValOutersWithGenerics.java26
-rw-r--r--test/transform/resource/before/ValWeirdTypes.java2
-rw-r--r--test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages2
-rw-r--r--test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages4
-rw-r--r--test/transform/resource/messages-ecj/SimpleTypeResolution.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/SynchronizedName.java.messages1
-rw-r--r--test/transform/resource/messages-ecj/ValErrors.java.messages2
55 files changed, 689 insertions, 130 deletions
diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java
index a417d8ed..1d879a35 100644
--- a/test/core/src/lombok/RunTestsViaEcj.java
+++ b/test/core/src/lombok/RunTestsViaEcj.java
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 The Project Lombok Authors.
+ * Copyright (C) 2010-2012 The Project Lombok Authors.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -23,57 +23,104 @@ package lombok;
import java.io.File;
import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
import java.util.Locale;
-
-import lombok.eclipse.TransformEclipseAST;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.jdt.core.compiler.CategorizedProblem;
import org.eclipse.jdt.internal.compiler.CompilationResult;
+import org.eclipse.jdt.internal.compiler.Compiler;
+import org.eclipse.jdt.internal.compiler.ICompilerRequestor;
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
import org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
import org.eclipse.jdt.internal.compiler.batch.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.batch.FileSystem;
import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants;
+import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
-import org.eclipse.jdt.internal.compiler.parser.Parser;
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
-import org.eclipse.jdt.internal.compiler.problem.ProblemReporter;
public class RunTestsViaEcj extends AbstractRunTests {
- protected static CompilerOptions ecjCompilerOptions() {
+ protected CompilerOptions ecjCompilerOptions() {
CompilerOptions options = new CompilerOptions();
options.complianceLevel = ClassFileConstants.JDK1_6;
options.sourceLevel = ClassFileConstants.JDK1_6;
options.targetJDK = ClassFileConstants.JDK1_6;
options.parseLiteralExpressionsAsConstants = true;
+ options.inlineJsrBytecode = true;
+ options.reportUnusedDeclaredThrownExceptionExemptExceptionAndThrowable = false;
+ options.reportUnusedDeclaredThrownExceptionIncludeDocCommentReference = false;
+ options.reportUnusedDeclaredThrownExceptionWhenOverriding = false;
+ options.reportUnusedParameterIncludeDocCommentReference = false;
+ options.reportUnusedParameterWhenImplementingAbstract = false;
+ options.reportUnusedParameterWhenOverridingConcrete = false;
+ options.reportDeadCodeInTrivialIfStatement = false;
+ options.generateClassFiles = false;
+ options.docCommentSupport = false;
+ Map<String, String> warnings = new HashMap<String, String>();
+ warnings.put(CompilerOptions.OPTION_ReportUnusedLocal, "ignore");
+ warnings.put(CompilerOptions.OPTION_ReportUnusedLabel, "ignore");
+ warnings.put(CompilerOptions.OPTION_ReportUnusedImport, "ignore");
+ warnings.put(CompilerOptions.OPTION_ReportUnusedPrivateMember, "ignore");
+ options.set(warnings);
return options;
}
- @Override
- public void transformCode(final StringBuilder messages, StringWriter result, File file) throws Throwable {
- ProblemReporter problemReporter = new ProblemReporter(new IErrorHandlingPolicy() {
- public boolean proceedOnErrors() {
+ protected IErrorHandlingPolicy ecjErrorHandlingPolicy() {
+ return new IErrorHandlingPolicy() {
+ @Override public boolean stopOnFirstError() {
return true;
}
- public boolean stopOnFirstError() {
+ @Override public boolean proceedOnErrors() {
return false;
}
- }, ecjCompilerOptions(), new DefaultProblemFactory(Locale.ENGLISH));
+ };
+ }
+
+ @Override
+ public void transformCode(final StringBuilder messages, StringWriter result, File file) throws Throwable {
+ final AtomicReference<CompilationResult> compilationResult_ = new AtomicReference<CompilationResult>();
+ final AtomicReference<CompilationUnitDeclaration> compilationUnit_ = new AtomicReference<CompilationUnitDeclaration>();
+ ICompilerRequestor bitbucketRequestor = new ICompilerRequestor() {
+ @Override public void acceptResult(CompilationResult result) {
+ compilationResult_.set(result);
+ }
+ };
+
+ List<String> classpath = new ArrayList<String>();
+ classpath.addAll(Arrays.asList(System.getProperty("sun.boot.class.path").split(File.pathSeparator)));
+ classpath.add("dist/lombok.jar");
+ classpath.add("lib/test/commons-logging.jar");
+ classpath.add("lib/test/slf4j-api.jar");
+ classpath.add("lib/test/log4j.jar");
+ FileSystem fileAccess = new FileSystem(classpath.toArray(new String[0]), new String[] {file.getAbsolutePath()}, "UTF-8");
- Parser parser = new Parser(problemReporter, true);
String source = readFile(file);
- CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), "UTF-8");
- CompilationResult compilationResult = new CompilationResult(sourceUnit, 0, 0, 0);
- CompilationUnitDeclaration cud = parser.parse(sourceUnit, compilationResult);
+ final CompilationUnit sourceUnit = new CompilationUnit(source.toCharArray(), file.getName(), "UTF-8");
- TransformEclipseAST.transform(parser, cud);
+ Compiler ecjCompiler = new Compiler(fileAccess, ecjErrorHandlingPolicy(), ecjCompilerOptions(), bitbucketRequestor, new DefaultProblemFactory(Locale.ENGLISH)) {
+ @Override protected synchronized void addCompilationUnit(ICompilationUnit inUnit, CompilationUnitDeclaration parsedUnit) {
+ if (inUnit == sourceUnit) compilationUnit_.set(parsedUnit);
+ super.addCompilationUnit(inUnit, parsedUnit);
+ }
+ };
+
+ ecjCompiler.compile(new ICompilationUnit[] {sourceUnit});
+ CompilationResult compilationResult = compilationResult_.get();
CategorizedProblem[] problems = compilationResult.getAllProblems();
if (problems != null) for (CategorizedProblem p : problems) {
messages.append(String.format("%d %s %s\n", p.getSourceLineNumber(), p.isError() ? "error" : p.isWarning() ? "warning" : "unknown", p.getMessage()));
}
+ CompilationUnitDeclaration cud = compilationUnit_.get();
+
result.append(cud.toString());
}
}
diff --git a/test/transform/resource/after-delombok/Constructors.java b/test/transform/resource/after-delombok/Constructors.java
index fb906c73..baea640f 100644
--- a/test/transform/resource/after-delombok/Constructors.java
+++ b/test/transform/resource/after-delombok/Constructors.java
@@ -39,7 +39,7 @@ class AllArgsConstructor1 {
}
}
class NoArgsConstructor1 {
- final int x;
+ int x;
String name;
@java.lang.SuppressWarnings("all")
public NoArgsConstructor1() {
diff --git a/test/transform/resource/after-delombok/DataPlain.java b/test/transform/resource/after-delombok/DataPlain.java
index 5124fbeb..86d0ec18 100644
--- a/test/transform/resource/after-delombok/DataPlain.java
+++ b/test/transform/resource/after-delombok/DataPlain.java
@@ -144,7 +144,7 @@ final class Data3 {
}
}
final class Data4 extends java.util.Timer {
- final int x;
+ int x;
Data4() {
super();
}
@@ -152,6 +152,10 @@ final class Data4 extends java.util.Timer {
public int getX() {
return this.x;
}
+ @java.lang.SuppressWarnings("all")
+ public void setX(final int x) {
+ this.x = x;
+ }
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java
index ee34018a..08d682a2 100644
--- a/test/transform/resource/after-delombok/DelegateOnGetter.java
+++ b/test/transform/resource/after-delombok/DelegateOnGetter.java
@@ -11,13 +11,14 @@ class DelegateOnGetter {
synchronized (this.bar) {
value = this.bar.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<Bar>(new Bar(){
+ final Bar actualValue = new Bar(){
public void setList(java.util.ArrayList<String> list) {
}
public int getInt() {
return 42;
}
- });
+ };
+ value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue);
this.bar.set(value);
}
}
diff --git a/test/transform/resource/after-delombok/DelegateOnGetterNone.java b/test/transform/resource/after-delombok/DelegateOnGetterNone.java
index b3258f25..9f9411f4 100644
--- a/test/transform/resource/after-delombok/DelegateOnGetterNone.java
+++ b/test/transform/resource/after-delombok/DelegateOnGetterNone.java
@@ -1,5 +1,5 @@
class DelegateOnGetterNone {
- private final Bar bar;
+ private final Bar bar = null;
private interface Bar {
void setList(java.util.ArrayList<java.lang.String> list);
int getInt();
diff --git a/test/transform/resource/after-delombok/GetterAlreadyExists.java b/test/transform/resource/after-delombok/GetterAlreadyExists.java
index d0a01c88..8389ae31 100644
--- a/test/transform/resource/after-delombok/GetterAlreadyExists.java
+++ b/test/transform/resource/after-delombok/GetterAlreadyExists.java
@@ -123,7 +123,7 @@ class Getter15 {
class Getter16 {
String foo;
static String hasFoo() {
- return false;
+ return "";
}
@java.lang.SuppressWarnings("all")
public String getFoo() {
@@ -133,7 +133,7 @@ class Getter16 {
class Getter17 {
String foo;
static String isFoo() {
- return false;
+ return "";
}
@java.lang.SuppressWarnings("all")
public String getFoo() {
@@ -143,6 +143,6 @@ class Getter17 {
class Getter18 {
String foo;
static String getFoo() {
- return false;
+ return "";
}
} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java
index d7f97f0d..95be39e3 100644
--- a/test/transform/resource/after-delombok/GetterLazy.java
+++ b/test/transform/resource/after-delombok/GetterLazy.java
@@ -9,7 +9,8 @@ class GetterLazy {
synchronized (this.fieldName) {
value = this.fieldName.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType());
+ final ValueType actualValue = new ValueType();
+ value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue);
this.fieldName.set(value);
}
}
diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
index 74ce716e..a542061d 100644
--- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java
+++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
@@ -43,7 +43,8 @@ class GetterLazyEahcToString {
synchronized (this.value) {
value = this.value.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<String>("");
+ final String actualValue = "";
+ value = new java.util.concurrent.atomic.AtomicReference<String>(actualValue);
this.value.set(value);
}
}
diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java
index 650d0496..29e7d66d 100644
--- a/test/transform/resource/after-delombok/GetterLazyNative.java
+++ b/test/transform/resource/after-delombok/GetterLazyNative.java
@@ -15,7 +15,8 @@ class GetterLazyNative {
synchronized (this.booleanField) {
value = this.booleanField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true);
+ final boolean actualValue = true;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue);
this.booleanField.set(value);
}
}
@@ -29,7 +30,8 @@ class GetterLazyNative {
synchronized (this.byteField) {
value = this.byteField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1);
+ final byte actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(actualValue);
this.byteField.set(value);
}
}
@@ -43,7 +45,8 @@ class GetterLazyNative {
synchronized (this.shortField) {
value = this.shortField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1);
+ final short actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(actualValue);
this.shortField.set(value);
}
}
@@ -57,7 +60,8 @@ class GetterLazyNative {
synchronized (this.intField) {
value = this.intField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1);
+ final int actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(actualValue);
this.intField.set(value);
}
}
@@ -71,7 +75,8 @@ class GetterLazyNative {
synchronized (this.longField) {
value = this.longField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1);
+ final long actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(actualValue);
this.longField.set(value);
}
}
@@ -85,7 +90,8 @@ class GetterLazyNative {
synchronized (this.floatField) {
value = this.floatField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0F);
+ final float actualValue = 1.0F;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(actualValue);
this.floatField.set(value);
}
}
@@ -99,7 +105,8 @@ class GetterLazyNative {
synchronized (this.doubleField) {
value = this.doubleField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0);
+ final double actualValue = 1.0;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(actualValue);
this.doubleField.set(value);
}
}
@@ -113,7 +120,8 @@ class GetterLazyNative {
synchronized (this.charField) {
value = this.charField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1');
+ final char actualValue = '1';
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>(actualValue);
this.charField.set(value);
}
}
@@ -127,7 +135,8 @@ class GetterLazyNative {
synchronized (this.intArrayField) {
value = this.intArrayField.get();
if (value == null) {
- value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1});
+ final int[] actualValue = new int[]{1};
+ value = new java.util.concurrent.atomic.AtomicReference<int[]>(actualValue);
this.intArrayField.set(value);
}
}
diff --git a/test/transform/resource/after-delombok/ToStringInner.java b/test/transform/resource/after-delombok/ToStringInner.java
index bd8967b7..7b1d5e21 100644
--- a/test/transform/resource/after-delombok/ToStringInner.java
+++ b/test/transform/resource/after-delombok/ToStringInner.java
@@ -1,8 +1,8 @@
class ToStringOuter {
- final int x;
+ int x;
String name;
class ToStringInner {
- final int y;
+ int y;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
@@ -10,7 +10,7 @@ class ToStringOuter {
}
}
static class ToStringStaticInner {
- final int y;
+ int y;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
@@ -19,7 +19,7 @@ class ToStringOuter {
}
class ToStringMiddle {
class ToStringMoreInner {
- final String name;
+ String name;
@java.lang.Override
@java.lang.SuppressWarnings("all")
public java.lang.String toString() {
diff --git a/test/transform/resource/after-delombok/ToStringPlain.java b/test/transform/resource/after-delombok/ToStringPlain.java
index 20227464..e6f3db7a 100644
--- a/test/transform/resource/after-delombok/ToStringPlain.java
+++ b/test/transform/resource/after-delombok/ToStringPlain.java
@@ -1,5 +1,5 @@
class ToString1 {
- final int x;
+ int x;
String name;
@java.lang.Override
@java.lang.SuppressWarnings("all")
@@ -8,7 +8,7 @@ class ToString1 {
}
}
class ToString2 {
- final int x;
+ int x;
String name;
@java.lang.Override
@java.lang.SuppressWarnings("all")
diff --git a/test/transform/resource/after-delombok/ValComplex.java b/test/transform/resource/after-delombok/ValComplex.java
index 54ef5c78..0df87fac 100644
--- a/test/transform/resource/after-delombok/ValComplex.java
+++ b/test/transform/resource/after-delombok/ValComplex.java
@@ -1,8 +1,8 @@
public class ValComplex {
- private ValSimple field = new ValSimple();
+ private String field = "";
private static final int CONSTANT = 20;
- public void testReferencingOtherFiles() {
- final java.lang.String shouldBeString = field.method();
+ public void testComplex() {
+ final char[] shouldBeCharArray = field.toCharArray();
final int shouldBeInt = CONSTANT;
final java.lang.Object lock = new Object();
synchronized (lock) {
@@ -10,11 +10,11 @@ public class ValComplex {
final int inner = 10;
switch (field) {
case 5:
- final java.lang.String shouldBeString2 = shouldBeString;
+ final char[] shouldBeCharArray2 = shouldBeCharArray;
final int innerInner = inner;
}
}
- final ValSimple shouldBeValSimple = field; //Unshadowing
+ final java.lang.String shouldBeString = field; //Unshadowing
}
} \ No newline at end of file
diff --git a/test/transform/resource/after-delombok/ValInFor.java b/test/transform/resource/after-delombok/ValInFor.java
index 013cd02e..de75803b 100644
--- a/test/transform/resource/after-delombok/ValInFor.java
+++ b/test/transform/resource/after-delombok/ValInFor.java
@@ -1,14 +1,4 @@
public class ValInFor {
- {
- final int x = 10;
- final int x2 = -1;
- final java.lang.String a = "Hello";
- for (final int y = x, z = x2; y < 20; y++) {
- final int q = y;
- final int w = z;
- final java.lang.String v = a;
- }
- }
public void enhancedFor() {
java.util.List<String> list = java.util.Arrays.asList("Hello, World!");
for (final java.lang.String shouldBeString : list) {
diff --git a/test/transform/resource/after-delombok/ValOutersWithGenerics.java b/test/transform/resource/after-delombok/ValOutersWithGenerics.java
new file mode 100644
index 00000000..150e3a2a
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValOutersWithGenerics.java
@@ -0,0 +1,21 @@
+import java.util.*;
+public class ValOutersWithGenerics<Z> {
+ class Inner {
+ }
+ public void testOutersWithGenerics() {
+ final java.lang.String foo = "";
+ List<Inner> list = new ArrayList<Inner>();
+ final ValOutersWithGenerics<Z>.Inner elem = list.get(0);
+ }
+ public void testLocalClasses() {
+ class Local<A> {
+ }
+ final Local<java.lang.String> q = new Local<String>();
+ }
+ static class SubClass extends ValOutersWithGenerics<String> {
+ public void testSubClassOfOutersWithGenerics() {
+ List<Inner> list = new ArrayList<Inner>();
+ final ValOutersWithGenerics<java.lang.String>.Inner elem = list.get(0);
+ }
+ }
+}
diff --git a/test/transform/resource/after-delombok/ValWeirdTypes.java b/test/transform/resource/after-delombok/ValWeirdTypes.java
index 34beb80b..9eb211b3 100644
--- a/test/transform/resource/after-delombok/ValWeirdTypes.java
+++ b/test/transform/resource/after-delombok/ValWeirdTypes.java
@@ -1,6 +1,6 @@
import java.util.*;
public class ValWeirdTypes<Z> {
- private final List<Z> fieldList;
+ private List<Z> fieldList;
public void testGenerics() {
List<String> list = new ArrayList<String>();
list.add("Hello, World!");
diff --git a/test/transform/resource/after-ecj/Constructors.java b/test/transform/resource/after-ecj/Constructors.java
index e47ec8b5..3b3a14da 100644
--- a/test/transform/resource/after-ecj/Constructors.java
+++ b/test/transform/resource/after-ecj/Constructors.java
@@ -35,7 +35,7 @@
}
}
@lombok.NoArgsConstructor class NoArgsConstructor1 {
- final int x;
+ int x;
String name;
public @java.lang.SuppressWarnings("all") NoArgsConstructor1() {
super();
diff --git a/test/transform/resource/after-ecj/DataPlain.java b/test/transform/resource/after-ecj/DataPlain.java
index 0c4a6ab0..6322d347 100644
--- a/test/transform/resource/after-ecj/DataPlain.java
+++ b/test/transform/resource/after-ecj/DataPlain.java
@@ -127,10 +127,13 @@ final @Data class Data3 {
}
}
final @Data @lombok.EqualsAndHashCode(callSuper = true) class Data4 extends java.util.Timer {
- final int x;
+ int x;
public @java.lang.SuppressWarnings("all") int getX() {
return this.x;
}
+ public @java.lang.SuppressWarnings("all") void setX(final int x) {
+ this.x = x;
+ }
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (("Data4(x=" + this.getX()) + ")");
}
diff --git a/test/transform/resource/after-ecj/DelegateOnGetter.java b/test/transform/resource/after-ecj/DelegateOnGetter.java
index cb06d3c1..4b10bf7f 100644
--- a/test/transform/resource/after-ecj/DelegateOnGetter.java
+++ b/test/transform/resource/after-ecj/DelegateOnGetter.java
@@ -1 +1,44 @@
-//ignore \ No newline at end of file
+import lombok.Delegate;
+import lombok.Getter;
+class DelegateOnGetter {
+ private interface Bar {
+ void setList(java.util.ArrayList<java.lang.String> list);
+ int getInt();
+ }
+ private final @Delegate @Getter(lazy = true) java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>> bar = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>>();
+ public @Delegate @java.lang.SuppressWarnings("all") Bar getBar() {
+ java.util.concurrent.atomic.AtomicReference<Bar> value = this.bar.get();
+ if ((value == null))
+ {
+ synchronized (this.bar)
+ {
+ value = this.bar.get();
+ if ((value == null))
+ {
+ final Bar actualValue = new Bar() {
+ x() {
+ super();
+ }
+ public void setList(java.util.ArrayList<String> list) {
+ }
+ public int getInt() {
+ return 42;
+ }
+ };
+ value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue);
+ this.bar.set(value);
+ }
+ }
+ }
+ return value.get();
+ }
+ public @java.lang.SuppressWarnings("all") int getInt() {
+ return this.getBar().getInt();
+ }
+ public @java.lang.SuppressWarnings("all") void setList(final java.util.ArrayList<java.lang.String> list) {
+ this.getBar().setList(list);
+ }
+ DelegateOnGetter() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/DelegateOnGetterNone.java b/test/transform/resource/after-ecj/DelegateOnGetterNone.java
index cb06d3c1..0e303936 100644
--- a/test/transform/resource/after-ecj/DelegateOnGetterNone.java
+++ b/test/transform/resource/after-ecj/DelegateOnGetterNone.java
@@ -1 +1,19 @@
-//ignore \ No newline at end of file
+import lombok.AccessLevel;
+import lombok.Delegate;
+import lombok.Getter;
+@Getter class DelegateOnGetterNone {
+ private interface Bar {
+ void setList(java.util.ArrayList<java.lang.String> list);
+ int getInt();
+ }
+ private final @Delegate @Getter(AccessLevel.NONE) Bar bar = null;
+ public @java.lang.SuppressWarnings("all") int getInt() {
+ return this.bar.getInt();
+ }
+ public @java.lang.SuppressWarnings("all") void setList(final java.util.ArrayList<java.lang.String> list) {
+ this.bar.setList(list);
+ }
+ DelegateOnGetterNone() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/DelegateOnMethods.java b/test/transform/resource/after-ecj/DelegateOnMethods.java
index cb06d3c1..37922e2a 100644
--- a/test/transform/resource/after-ecj/DelegateOnMethods.java
+++ b/test/transform/resource/after-ecj/DelegateOnMethods.java
@@ -1 +1,13 @@
-//ignore \ No newline at end of file
+import lombok.Delegate;
+abstract class DelegateOnMethods {
+ public static interface Bar {
+ void bar(java.util.ArrayList<java.lang.String> list);
+ }
+ public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) {
+ this.getBar().bar(list);
+ }
+ DelegateOnMethods() {
+ super();
+ }
+ public abstract @Delegate Bar getBar();
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java b/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java
index cb06d3c1..821c0851 100644
--- a/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java
+++ b/test/transform/resource/after-ecj/DelegateTypesAndExcludes.java
@@ -1 +1,36 @@
-//ignore \ No newline at end of file
+import lombok.Delegate;
+class DelegatePlain {
+ private static class FooImpl implements Foo {
+ private FooImpl() {
+ super();
+ }
+ public void foo() {
+ }
+ public void bar(java.util.ArrayList<java.lang.String> list) {
+ }
+ }
+ private static class BarImpl implements Bar {
+ private BarImpl() {
+ super();
+ }
+ public void bar(java.util.ArrayList<java.lang.String> list) {
+ }
+ }
+ private static interface Foo extends Bar {
+ void foo();
+ }
+ private static interface Bar {
+ void bar(java.util.ArrayList<java.lang.String> list);
+ }
+ private final @Delegate(types = Bar.class) BarImpl bar = new BarImpl();
+ private final @Delegate(types = Foo.class,excludes = Bar.class) FooImpl foo = new FooImpl();
+ public @java.lang.SuppressWarnings("all") void bar(final java.util.ArrayList<java.lang.String> list) {
+ this.bar.bar(list);
+ }
+ public @java.lang.SuppressWarnings("all") void foo() {
+ this.foo.foo();
+ }
+ DelegatePlain() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/GetterAlreadyExists.java b/test/transform/resource/after-ecj/GetterAlreadyExists.java
index 257457bb..d5bb7e60 100644
--- a/test/transform/resource/after-ecj/GetterAlreadyExists.java
+++ b/test/transform/resource/after-ecj/GetterAlreadyExists.java
@@ -166,7 +166,7 @@ class Getter16 {
super();
}
static String hasFoo() {
- return false;
+ return "";
}
}
class Getter17 {
@@ -178,7 +178,7 @@ class Getter17 {
super();
}
static String isFoo() {
- return false;
+ return "";
}
}
class Getter18 {
@@ -187,6 +187,6 @@ class Getter18 {
super();
}
static String getFoo() {
- return false;
+ return "";
}
}
diff --git a/test/transform/resource/after-ecj/GetterLazy.java b/test/transform/resource/after-ecj/GetterLazy.java
index 669a9a81..89aaa40f 100644
--- a/test/transform/resource/after-ecj/GetterLazy.java
+++ b/test/transform/resource/after-ecj/GetterLazy.java
@@ -14,7 +14,8 @@ class GetterLazy {
value = this.fieldName.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<ValueType>(new ValueType());
+ final ValueType actualValue = new ValueType();
+ value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue);
this.fieldName.set(value);
}
}
diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java
index 4876bd67..15c774a2 100644
--- a/test/transform/resource/after-ecj/GetterLazyEahcToString.java
+++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java
@@ -10,7 +10,8 @@
value = this.value.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<String>("");
+ final String actualValue = "";
+ value = new java.util.concurrent.atomic.AtomicReference<String>(actualValue);
this.value.set(value);
}
}
diff --git a/test/transform/resource/after-ecj/GetterLazyNative.java b/test/transform/resource/after-ecj/GetterLazyNative.java
index 6c90a101..da1357a0 100644
--- a/test/transform/resource/after-ecj/GetterLazyNative.java
+++ b/test/transform/resource/after-ecj/GetterLazyNative.java
@@ -17,7 +17,8 @@ class GetterLazyNative {
value = this.booleanField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(true);
+ final boolean actualValue = true;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue);
this.booleanField.set(value);
}
}
@@ -33,7 +34,8 @@ class GetterLazyNative {
value = this.byteField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(1);
+ final byte actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(actualValue);
this.byteField.set(value);
}
}
@@ -49,7 +51,8 @@ class GetterLazyNative {
value = this.shortField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(1);
+ final short actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(actualValue);
this.shortField.set(value);
}
}
@@ -65,7 +68,8 @@ class GetterLazyNative {
value = this.intField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(1);
+ final int actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(actualValue);
this.intField.set(value);
}
}
@@ -81,7 +85,8 @@ class GetterLazyNative {
value = this.longField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(1);
+ final long actualValue = 1;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(actualValue);
this.longField.set(value);
}
}
@@ -97,7 +102,8 @@ class GetterLazyNative {
value = this.floatField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(1.0f);
+ final float actualValue = 1.0f;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(actualValue);
this.floatField.set(value);
}
}
@@ -113,7 +119,8 @@ class GetterLazyNative {
value = this.doubleField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(1.0);
+ final double actualValue = 1.0;
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(actualValue);
this.doubleField.set(value);
}
}
@@ -129,7 +136,8 @@ class GetterLazyNative {
value = this.charField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>('1');
+ final char actualValue = '1';
+ value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>(actualValue);
this.charField.set(value);
}
}
@@ -145,7 +153,8 @@ class GetterLazyNative {
value = this.intArrayField.get();
if ((value == null))
{
- value = new java.util.concurrent.atomic.AtomicReference<int[]>(new int[]{1});
+ final int[] actualValue = new int[]{1};
+ value = new java.util.concurrent.atomic.AtomicReference<int[]>(actualValue);
this.intArrayField.set(value);
}
}
diff --git a/test/transform/resource/after-ecj/SimpleTypeResolution.java b/test/transform/resource/after-ecj/SimpleTypeResolution.java
index a0997c67..b049c62e 100644
--- a/test/transform/resource/after-ecj/SimpleTypeResolution.java
+++ b/test/transform/resource/after-ecj/SimpleTypeResolution.java
@@ -1,7 +1,6 @@
class SimpleTypeResolutionFail {
private @Getter int x;
SimpleTypeResolutionFail() {
- super();
}
}
class SimpleTypeResolutionSuccess {
@@ -10,6 +9,5 @@ class SimpleTypeResolutionSuccess {
return this.x;
}
SimpleTypeResolutionSuccess() {
- super();
}
}
diff --git a/test/transform/resource/after-ecj/ToStringInner.java b/test/transform/resource/after-ecj/ToStringInner.java
index 963299db..dc8696c5 100644
--- a/test/transform/resource/after-ecj/ToStringInner.java
+++ b/test/transform/resource/after-ecj/ToStringInner.java
@@ -1,7 +1,7 @@
import lombok.ToString;
@ToString class ToStringOuter {
@ToString class ToStringInner {
- final int y;
+ int y;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (("ToStringOuter.ToStringInner(y=" + this.y) + ")");
}
@@ -10,7 +10,7 @@ import lombok.ToString;
}
}
static @ToString class ToStringStaticInner {
- final int y;
+ int y;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (("ToStringOuter.ToStringStaticInner(y=" + this.y) + ")");
}
@@ -20,7 +20,7 @@ import lombok.ToString;
}
class ToStringMiddle {
@ToString class ToStringMoreInner {
- final String name;
+ String name;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (("ToStringOuter.ToStringMiddle.ToStringMoreInner(name=" + this.name) + ")");
}
@@ -32,7 +32,7 @@ import lombok.ToString;
super();
}
}
- final int x;
+ int x;
String name;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (((("ToStringOuter(x=" + this.x) + ", name=") + this.name) + ")");
diff --git a/test/transform/resource/after-ecj/ToStringPlain.java b/test/transform/resource/after-ecj/ToStringPlain.java
index 458f78d0..2361b32a 100644
--- a/test/transform/resource/after-ecj/ToStringPlain.java
+++ b/test/transform/resource/after-ecj/ToStringPlain.java
@@ -1,6 +1,6 @@
import lombok.ToString;
@lombok.ToString class ToString1 {
- final int x;
+ int x;
String name;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (((("ToString1(x=" + this.x) + ", name=") + this.name) + ")");
@@ -10,7 +10,7 @@ import lombok.ToString;
}
}
@ToString class ToString2 {
- final int x;
+ int x;
String name;
public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
return (((("ToString2(x=" + this.x) + ", name=") + this.name) + ")");
diff --git a/test/transform/resource/after-ecj/TrickyTypeResolution.java b/test/transform/resource/after-ecj/TrickyTypeResolution.java
index cb06d3c1..fb807709 100644
--- a/test/transform/resource/after-ecj/TrickyTypeResolution.java
+++ b/test/transform/resource/after-ecj/TrickyTypeResolution.java
@@ -1 +1,87 @@
-//ignore \ No newline at end of file
+import lombok.*;
+class TrickyDoNothing {
+ @interface Getter {
+ }
+ @Getter int x;
+ TrickyDoNothing() {
+ super();
+ }
+}
+class TrickyDoNothing2 {
+ @interface Getter {
+ }
+ @Getter int x;
+ TrickyDoNothing2() {
+ super();
+ }
+}
+class TrickySuccess {
+ @Getter int x;
+ public @java.lang.SuppressWarnings("all") int getX() {
+ return this.x;
+ }
+ TrickySuccess() {
+ super();
+ }
+}
+class TrickyDoNothing3 {
+ TrickyDoNothing3() {
+ super();
+ }
+ void test() {
+ class val {
+ val() {
+ super();
+ }
+ }
+ val x = null;
+ }
+}
+class TrickyDoSomething {
+ TrickyDoSomething() {
+ super();
+ }
+ void test() {
+ final @val java.lang.Object x = null;
+ class val {
+ val() {
+ super();
+ }
+ }
+ }
+}
+class DoubleTrickyDoNothing {
+ DoubleTrickyDoNothing() {
+ super();
+ }
+ void test() {
+ class val {
+ val() {
+ super();
+ }
+ }
+ for (int i = 10;; (i < 20); i ++)
+ {
+ val y = null;
+ }
+ }
+}
+class DoubleTrickyDoSomething {
+ DoubleTrickyDoSomething() {
+ super();
+ }
+ void test() {
+ for (int j = 10;; (j < 20); j ++)
+ {
+ class val {
+ val() {
+ super();
+ }
+ }
+ }
+ for (int i = 10;; (i < 20); i ++)
+ {
+ final @val java.lang.Object y = null;
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/TrickyTypeResolution2.java b/test/transform/resource/after-ecj/TrickyTypeResolution2.java
index cb06d3c1..d9c5f9b0 100644
--- a/test/transform/resource/after-ecj/TrickyTypeResolution2.java
+++ b/test/transform/resource/after-ecj/TrickyTypeResolution2.java
@@ -1 +1,14 @@
-//ignore \ No newline at end of file
+import lombok.*;
+class DoNothingDueToTopLevel {
+ DoNothingDueToTopLevel() {
+ super();
+ }
+ void test() {
+ val x = null;
+ }
+}
+class val {
+ val() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValComplex.java b/test/transform/resource/after-ecj/ValComplex.java
index cb06d3c1..6e435e56 100644
--- a/test/transform/resource/after-ecj/ValComplex.java
+++ b/test/transform/resource/after-ecj/ValComplex.java
@@ -1 +1,26 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValComplex {
+ private String field = "";
+ private static final int CONSTANT = 20;
+ <clinit>() {
+ }
+ public ValComplex() {
+ super();
+ }
+ public void testComplex() {
+ final @val char[] shouldBeCharArray = field.toCharArray();
+ final @val int shouldBeInt = CONSTANT;
+ final @val java.lang.Object lock = new Object();
+ synchronized (lock)
+ {
+ final @val int field = 20;
+ final @val int inner = 10;
+ switch (field) {
+ case 5 : ;
+ final @val char[] shouldBeCharArray2 = shouldBeCharArray;
+ final @val int innerInner = inner;
+ }
+ }
+ final @val java.lang.String shouldBeString = field;
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValErrors.java b/test/transform/resource/after-ecj/ValErrors.java
index cb06d3c1..1bd61f87 100644
--- a/test/transform/resource/after-ecj/ValErrors.java
+++ b/test/transform/resource/after-ecj/ValErrors.java
@@ -1 +1,12 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValErrors {
+ public ValErrors() {
+ super();
+ }
+ public void unresolvableExpression() {
+ val c = d;
+ }
+ public void arrayInitializer() {
+ val e = {"foo", "bar"};
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValInFor.java b/test/transform/resource/after-ecj/ValInFor.java
index cb06d3c1..1b6c13d0 100644
--- a/test/transform/resource/after-ecj/ValInFor.java
+++ b/test/transform/resource/after-ecj/ValInFor.java
@@ -1 +1,14 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValInFor {
+ public ValInFor() {
+ super();
+ }
+ public void enhancedFor() {
+ java.util.List<String> list = java.util.Arrays.asList("Hello, World!");
+ for (final @val java.lang.String shouldBeString : list)
+ {
+ System.out.println(shouldBeString.toLowerCase());
+ final @val java.lang.String shouldBeString2 = shouldBeString;
+ }
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValLessSimple.java b/test/transform/resource/after-ecj/ValLessSimple.java
index cb06d3c1..c7587f91 100644
--- a/test/transform/resource/after-ecj/ValLessSimple.java
+++ b/test/transform/resource/after-ecj/ValLessSimple.java
@@ -1 +1,39 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValLessSimple {
+ private short field2 = 5;
+ {
+ System.out.println("Hello");
+ final @val int z = 20;
+ final @val int x = 10;
+ final @val int a = z;
+ final @val short y = field2;
+ }
+ private String field = "field";
+ public ValLessSimple() {
+ super();
+ }
+ private String method() {
+ return "method";
+ }
+ private double method2() {
+ return 2.0;
+ }
+ private void testVal(String param) {
+ final @val java.lang.String fieldV = field;
+ final @val int a = 10;
+ final @val int b = 20;
+ {
+ final @val java.lang.String methodV = method();
+ final @val java.lang.String foo = (fieldV + methodV);
+ }
+ }
+ private void testValInCatchBlock() {
+ try
+ {
+ final @val int x = (1 / 0);
+ }
+ catch (ArithmeticException e) {
+ final @val int y = 0;
+ }
+ }
+}
diff --git a/test/transform/resource/after-ecj/ValOutersWithGenerics.java b/test/transform/resource/after-ecj/ValOutersWithGenerics.java
new file mode 100644
index 00000000..b4225ede
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValOutersWithGenerics.java
@@ -0,0 +1,34 @@
+import java.util.*;
+import lombok.val;
+public class ValOutersWithGenerics<Z> {
+ class Inner {
+ Inner() {
+ super();
+ }
+ }
+ static class SubClass extends ValOutersWithGenerics<String> {
+ SubClass() {
+ super();
+ }
+ public void testSubClassOfOutersWithGenerics() {
+ List<Inner> list = new ArrayList<Inner>();
+ final @val ValOutersWithGenerics<java.lang.String>.Inner elem = list.get(0);
+ }
+ }
+ public ValOutersWithGenerics() {
+ super();
+ }
+ public void testOutersWithGenerics() {
+ final @val java.lang.String foo = "";
+ List<Inner> list = new ArrayList<Inner>();
+ final @val ValOutersWithGenerics<Z>.Inner elem = list.get(0);
+ }
+ public void testLocalClasses() {
+ class Local<A> {
+ Local() {
+ super();
+ }
+ }
+ final @val Local<java.lang.String> q = new Local<String>();
+ }
+}
diff --git a/test/transform/resource/after-ecj/ValSimple.java b/test/transform/resource/after-ecj/ValSimple.java
index cb06d3c1..3a8fb188 100644
--- a/test/transform/resource/after-ecj/ValSimple.java
+++ b/test/transform/resource/after-ecj/ValSimple.java
@@ -1 +1,25 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValSimple {
+ private String field = "field";
+ private short field2 = 5;
+ public ValSimple() {
+ super();
+ }
+ private String method() {
+ return "method";
+ }
+ private double method2() {
+ return 2.0;
+ }
+ private void testVal(String param) {
+ final @val java.lang.String fieldV = field;
+ final @val java.lang.String methodV = method();
+ final @val java.lang.String paramV = param;
+ final @val java.lang.String valOfVal = fieldV;
+ final @val java.lang.String operatorV = (fieldV + valOfVal);
+ final @val short fieldW = field2;
+ final @val double methodW = method2();
+ byte localVar = 3;
+ final @val int operatorW = (fieldW + localVar);
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValWeirdTypes.java b/test/transform/resource/after-ecj/ValWeirdTypes.java
index cb06d3c1..516a3932 100644
--- a/test/transform/resource/after-ecj/ValWeirdTypes.java
+++ b/test/transform/resource/after-ecj/ValWeirdTypes.java
@@ -1 +1,64 @@
-//ignore \ No newline at end of file
+import java.util.*;
+import lombok.val;
+public class ValWeirdTypes<Z> {
+ private List<Z> fieldList;
+ public ValWeirdTypes() {
+ super();
+ }
+ public void testGenerics() {
+ List<String> list = new ArrayList<String>();
+ list.add("Hello, World!");
+ final @val java.lang.String shouldBeString = list.get(0);
+ final @val java.util.List<java.lang.String> shouldBeListOfString = list;
+ final @val java.util.List<java.lang.String> shouldBeListOfStringToo = Arrays.asList("hello", "world");
+ final @val java.lang.String shouldBeString2 = shouldBeListOfString.get(0);
+ }
+ public void testGenericsInference() {
+ final @val java.util.List<java.lang.Object> huh = Collections.emptyList();
+ final @val java.util.List<java.lang.Number> huh2 = Collections.<Number>emptyList();
+ }
+ public void testPrimitives() {
+ final @val int x = 10;
+ final @val long y = (5 + 3L);
+ }
+ public void testAnonymousInnerClass() {
+ final @val java.lang.Runnable y = new Runnable() {
+ x() {
+ super();
+ }
+ public void run() {
+ }
+ };
+ }
+ public <T extends Number>void testTypeParams(List<T> param) {
+ final @val T t = param.get(0);
+ final @val Z z = fieldList.get(0);
+ final @val java.util.List<T> k = param;
+ final @val java.util.List<Z> y = fieldList;
+ }
+ public void testBounds(List<? extends Number> lower, List<? super Number> upper) {
+ final @val java.lang.Number a = lower.get(0);
+ final @val java.lang.Object b = upper.get(0);
+ final @val java.util.List<? extends java.lang.Number> c = lower;
+ final @val java.util.List<? super java.lang.Number> d = upper;
+ List<?> unbound = lower;
+ final @val java.util.List<?> e = unbound;
+ }
+ public void testCompound() {
+ final @val java.util.ArrayList<java.lang.String> a = new ArrayList<String>();
+ final @val java.util.Vector<java.lang.String> b = new Vector<String>();
+ final @val boolean c = (1 < System.currentTimeMillis());
+ final @val java.util.AbstractList<java.lang.String> d = (c ? a : b);
+ java.util.RandomAccess confirm = (c ? a : b);
+ }
+ public void nullType() {
+ final @val java.lang.Object nully = null;
+ }
+ public void testArrays() {
+ final @val int[] intArray = new int[]{1, 2, 3};
+ final @val java.lang.Object[][] multiDimArray = new Object[][]{{}};
+ final @val int[] copy = intArray;
+ final @val java.lang.Object[] single = multiDimArray[0];
+ final @val int singleInt = copy[0];
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-ecj/ValWithLabel.java b/test/transform/resource/after-ecj/ValWithLabel.java
index cb06d3c1..0ce2be35 100644
--- a/test/transform/resource/after-ecj/ValWithLabel.java
+++ b/test/transform/resource/after-ecj/ValWithLabel.java
@@ -1 +1,15 @@
-//ignore \ No newline at end of file
+import lombok.val;
+public class ValWithLabel {
+ {
+ LABEL: for (final @val java.lang.String x : new String[0])
+ {
+ if ((x.toLowerCase() == null))
+ {
+ continue LABEL;
+ }
+ }
+ }
+ public ValWithLabel() {
+ super();
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/after-eclipse/GetterAlreadyExists.java b/test/transform/resource/after-eclipse/GetterAlreadyExists.java
index 257457bb..d5bb7e60 100644
--- a/test/transform/resource/after-eclipse/GetterAlreadyExists.java
+++ b/test/transform/resource/after-eclipse/GetterAlreadyExists.java
@@ -166,7 +166,7 @@ class Getter16 {
super();
}
static String hasFoo() {
- return false;
+ return "";
}
}
class Getter17 {
@@ -178,7 +178,7 @@ class Getter17 {
super();
}
static String isFoo() {
- return false;
+ return "";
}
}
class Getter18 {
@@ -187,6 +187,6 @@ class Getter18 {
super();
}
static String getFoo() {
- return false;
+ return "";
}
}
diff --git a/test/transform/resource/after-eclipse/ValOutersWithGenerics.java b/test/transform/resource/after-eclipse/ValOutersWithGenerics.java
new file mode 100644
index 00000000..c86d7767
--- /dev/null
+++ b/test/transform/resource/after-eclipse/ValOutersWithGenerics.java
@@ -0,0 +1,25 @@
+import java.util.*;
+import lombok.val;
+public class ValOutersWithGenerics<Z> {
+ class Inner {
+ Inner() {
+ super();
+ }
+ }
+ static class SubClass extends ValOutersWithGenerics<String> {
+ SubClass() {
+ super();
+ }
+ public void testSubClassOfOutersWithGenerics() {
+ List<Inner> list = new ArrayList<Inner>();
+ final ValOutersWithGenerics<java.lang.String>.Inner elem = list.get(0);
+ }
+ }
+ public ValOutersWithGenerics() {
+ super();
+ }
+ public void testOutersWithGenerics() {
+ List<Inner> list = new ArrayList<Inner>();
+ final ValOutersWithGenerics<Z>.Inner elem = list.get(0);
+ }
+}
diff --git a/test/transform/resource/before/Constructors.java b/test/transform/resource/before/Constructors.java
index bb39490a..6ac228d6 100644
--- a/test/transform/resource/before/Constructors.java
+++ b/test/transform/resource/before/Constructors.java
@@ -15,6 +15,6 @@
String name;
}
@lombok.NoArgsConstructor class NoArgsConstructor1 {
- final int x;
+ int x;
String name;
} \ No newline at end of file
diff --git a/test/transform/resource/before/DataPlain.java b/test/transform/resource/before/DataPlain.java
index e2469d44..e7e3da11 100644
--- a/test/transform/resource/before/DataPlain.java
+++ b/test/transform/resource/before/DataPlain.java
@@ -14,7 +14,7 @@ final @Data class Data3 {
@Data
@lombok.EqualsAndHashCode(callSuper=true)
final class Data4 extends java.util.Timer {
- final int x;
+ int x;
Data4() {
super();
}
diff --git a/test/transform/resource/before/DelegateOnGetterNone.java b/test/transform/resource/before/DelegateOnGetterNone.java
index f9642e6b..9db0ea38 100644
--- a/test/transform/resource/before/DelegateOnGetterNone.java
+++ b/test/transform/resource/before/DelegateOnGetterNone.java
@@ -5,7 +5,7 @@ import lombok.Getter;
@Getter
class DelegateOnGetterNone {
- @Delegate @Getter(AccessLevel.NONE) private final Bar bar;
+ @Delegate @Getter(AccessLevel.NONE) private final Bar bar = null;
private interface Bar {
void setList(java.util.ArrayList<java.lang.String> list);
diff --git a/test/transform/resource/before/GetterAlreadyExists.java b/test/transform/resource/before/GetterAlreadyExists.java
index 93b77dc1..426ab391 100644
--- a/test/transform/resource/before/GetterAlreadyExists.java
+++ b/test/transform/resource/before/GetterAlreadyExists.java
@@ -91,18 +91,18 @@ class Getter15 {
class Getter16 {
@lombok.Getter String foo;
static String hasFoo() {
- return false;
+ return "";
}
}
class Getter17 {
@lombok.Getter String foo;
static String isFoo() {
- return false;
+ return "";
}
}
class Getter18 {
@lombok.Getter String foo;
static String getFoo() {
- return false;
+ return "";
}
} \ No newline at end of file
diff --git a/test/transform/resource/before/ToStringInner.java b/test/transform/resource/before/ToStringInner.java
index f56865e0..728ee17f 100644
--- a/test/transform/resource/before/ToStringInner.java
+++ b/test/transform/resource/before/ToStringInner.java
@@ -1,16 +1,16 @@
import lombok.ToString;
@ToString class ToStringOuter {
- final int x;
+ int x;
String name;
@ToString class ToStringInner {
- final int y;
+ int y;
}
@ToString static class ToStringStaticInner {
- final int y;
+ int y;
}
class ToStringMiddle {
@ToString class ToStringMoreInner {
- final String name;
+ String name;
}
}
} \ No newline at end of file
diff --git a/test/transform/resource/before/ToStringPlain.java b/test/transform/resource/before/ToStringPlain.java
index 5b9db1c7..eaa1f463 100644
--- a/test/transform/resource/before/ToStringPlain.java
+++ b/test/transform/resource/before/ToStringPlain.java
@@ -1,9 +1,9 @@
import lombok.ToString;
@lombok.ToString class ToString1 {
- final int x;
+ int x;
String name;
}
@ToString class ToString2 {
- final int x;
+ int x;
String name;
} \ No newline at end of file
diff --git a/test/transform/resource/before/ValComplex.java b/test/transform/resource/before/ValComplex.java
index c2e53011..e20124a2 100644
--- a/test/transform/resource/before/ValComplex.java
+++ b/test/transform/resource/before/ValComplex.java
@@ -1,11 +1,11 @@
import lombok.val;
public class ValComplex {
- private ValSimple field = new ValSimple();
+ private String field = "";
private static final int CONSTANT = 20;
- public void testReferencingOtherFiles() {
- val shouldBeString = field.method();
+ public void testComplex() {
+ val shouldBeCharArray = field.toCharArray();
val shouldBeInt = CONSTANT;
val lock = new Object();
synchronized (lock) {
@@ -13,10 +13,10 @@ public class ValComplex {
val inner = 10;
switch (field) {
case 5:
- val shouldBeString2 = shouldBeString;
+ val shouldBeCharArray2 = shouldBeCharArray;
val innerInner = inner;
}
}
- val shouldBeValSimple = field; //Unshadowing
+ val shouldBeString = field; //Unshadowing
}
} \ No newline at end of file
diff --git a/test/transform/resource/before/ValInFor.java b/test/transform/resource/before/ValInFor.java
index ebe7287c..35332b34 100644
--- a/test/transform/resource/before/ValInFor.java
+++ b/test/transform/resource/before/ValInFor.java
@@ -1,17 +1,6 @@
import lombok.val;
public class ValInFor {
- {
- val x = 10;
- val x2 = -1;
- val a = "Hello";
- for (val y = x, z = x2; y < 20; y++) {
- val q = y;
- val w = z;
- val v = a;
- }
- }
-
public void enhancedFor() {
java.util.List<String> list = java.util.Arrays.asList("Hello, World!");
for (val shouldBeString : list) {
diff --git a/test/transform/resource/before/ValOutersWithGenerics.java b/test/transform/resource/before/ValOutersWithGenerics.java
new file mode 100644
index 00000000..145f812c
--- /dev/null
+++ b/test/transform/resource/before/ValOutersWithGenerics.java
@@ -0,0 +1,26 @@
+import java.util.*;
+import lombok.val;
+
+public class ValOutersWithGenerics<Z> {
+ class Inner {
+ }
+
+ public void testOutersWithGenerics() {
+ val foo = "";
+ List<Inner> list = new ArrayList<Inner>();
+ val elem = list.get(0);
+ }
+
+ public void testLocalClasses() {
+ class Local<A> {}
+
+ val q = new Local<String>();
+ }
+
+ static class SubClass extends ValOutersWithGenerics<String> {
+ public void testSubClassOfOutersWithGenerics() {
+ List<Inner> list = new ArrayList<Inner>();
+ val elem = list.get(0);
+ }
+ }
+}
diff --git a/test/transform/resource/before/ValWeirdTypes.java b/test/transform/resource/before/ValWeirdTypes.java
index 302ef841..8cba2de5 100644
--- a/test/transform/resource/before/ValWeirdTypes.java
+++ b/test/transform/resource/before/ValWeirdTypes.java
@@ -2,7 +2,7 @@ import java.util.*;
import lombok.val;
public class ValWeirdTypes<Z> {
- private final List<Z> fieldList;
+ private List<Z> fieldList;
public void testGenerics() {
List<String> list = new ArrayList<String>();
diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages
index 4a446f28..5fff2629 100644
--- a/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages
+++ b/test/transform/resource/messages-ecj/LoggerSlf4jOnNonType.java.messages
@@ -1 +1 @@
-2 error @Log is legal only on types. \ No newline at end of file
+2 error The annotation @Slf4j is disallowed for this location \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages b/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages
index 42236c7c..e23aa524 100644
--- a/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages
+++ b/test/transform/resource/messages-ecj/LoggerSlf4jTypes.java.messages
@@ -1,2 +1,2 @@
-1 error @Log is legal only on classes and enums.
-4 error @Log is legal only on classes and enums. \ No newline at end of file
+1 error @Slf4j is legal only on classes and enums.
+4 error @Slf4j is legal only on classes and enums. \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/SimpleTypeResolution.java.messages b/test/transform/resource/messages-ecj/SimpleTypeResolution.java.messages
new file mode 100644
index 00000000..2d49e9a9
--- /dev/null
+++ b/test/transform/resource/messages-ecj/SimpleTypeResolution.java.messages
@@ -0,0 +1 @@
+2 error Getter cannot be resolved to a type \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/SynchronizedName.java.messages b/test/transform/resource/messages-ecj/SynchronizedName.java.messages
index 2c94551c..d200ac0e 100644
--- a/test/transform/resource/messages-ecj/SynchronizedName.java.messages
+++ b/test/transform/resource/messages-ecj/SynchronizedName.java.messages
@@ -1 +1,2 @@
8 error The field write does not exist.
+11 error Cannot make a static reference to the non-static field SynchronizedName.read \ No newline at end of file
diff --git a/test/transform/resource/messages-ecj/ValErrors.java.messages b/test/transform/resource/messages-ecj/ValErrors.java.messages
new file mode 100644
index 00000000..0a23326c
--- /dev/null
+++ b/test/transform/resource/messages-ecj/ValErrors.java.messages
@@ -0,0 +1,2 @@
+5 error d cannot be resolved to a variable
+9 error 'val' is not compatible with array initializer expressions. Use the full form (new int[] { ... } instead of just { ... })