mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-14 22:17:41 +00:00
More test files, test files updated to be valid java, and ecj test now goes through the complete compile process. This means val and @Delegate testing is now enabled.
TODO: Update -eclipse tests.
This commit is contained in:
1 parent
5e9e16a6b9
commit
06581537f2
55 files changed
+691
-132
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
protected IErrorHandlingPolicy ecjErrorHandlingPolicy() {
|
||||
return new IErrorHandlingPolicy() {
|
||||
@Override public boolean stopOnFirstError() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean proceedOnErrors() {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transformCode(final StringBuilder messages, StringWriter result, File file) throws Throwable {
|
||||
ProblemReporter problemReporter = new ProblemReporter(new IErrorHandlingPolicy() {
|
||||
public boolean proceedOnErrors() {
|
||||
return true;
|
||||
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);
|
||||
}
|
||||
|
||||
public boolean stopOnFirstError() {
|
||||
return false;
|
||||
}
|
||||
}, ecjCompilerOptions(), new DefaultProblemFactory(Locale.ENGLISH));
|
||||
};
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class AllArgsConstructor1 {
|
||||
}
|
||||
}
|
||||
class NoArgsConstructor1 {
|
||||
final int x;
|
||||
int x;
|
||||
String name;
|
||||
@java.lang.SuppressWarnings("all")
|
||||
public NoArgsConstructor1() {
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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!");
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
}
|
||||
}
|
||||
@lombok.NoArgsConstructor class NoArgsConstructor1 {
|
||||
final int x;
|
||||
int x;
|
||||
String name;
|
||||
public @java.lang.SuppressWarnings("all") NoArgsConstructor1() {
|
||||
super();
|
||||
|
||||
@@ -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()) + ")");
|
||||
}
|
||||
|
||||
@@ -1 +1,44 @@
|
||||
//ignore
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1 +1,19 @@
|
||||
//ignore
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -1 +1,13 @@
|
||||
//ignore
|
||||
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();
|
||||
}
|
||||
@@ -1 +1,36 @@
|
||||
//ignore
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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) + ")");
|
||||
|
||||
@@ -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) + ")");
|
||||
|
||||
@@ -1 +1,87 @@
|
||||
//ignore
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,14 @@
|
||||
//ignore
|
||||
import lombok.*;
|
||||
class DoNothingDueToTopLevel {
|
||||
DoNothingDueToTopLevel() {
|
||||
super();
|
||||
}
|
||||
void test() {
|
||||
val x = null;
|
||||
}
|
||||
}
|
||||
class val {
|
||||
val() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
@@ -1 +1,26 @@
|
||||
//ignore
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1 +1,12 @@
|
||||
//ignore
|
||||
import lombok.val;
|
||||
public class ValErrors {
|
||||
public ValErrors() {
|
||||
super();
|
||||
}
|
||||
public void unresolvableExpression() {
|
||||
val c = d;
|
||||
}
|
||||
public void arrayInitializer() {
|
||||
val e = {"foo", "bar"};
|
||||
}
|
||||
}
|
||||
@@ -1 +1,14 @@
|
||||
//ignore
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +1,39 @@
|
||||
//ignore
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>();
|
||||
}
|
||||
}
|
||||
@@ -1 +1,25 @@
|
||||
//ignore
|
||||
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);
|
||||
}
|
||||
}
|
||||
@@ -1 +1,64 @@
|
||||
//ignore
|
||||
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];
|
||||
}
|
||||
}
|
||||
@@ -1 +1,15 @@
|
||||
//ignore
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,6 @@
|
||||
String name;
|
||||
}
|
||||
@lombok.NoArgsConstructor class NoArgsConstructor1 {
|
||||
final int x;
|
||||
int x;
|
||||
String name;
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 "";
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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>();
|
||||
|
||||
@@ -1 +1 @@
|
||||
2 error @Log is legal only on types.
|
||||
2 error The annotation @Slf4j is disallowed for this location
|
||||
@@ -1,2 +1,2 @@
|
||||
1 error @Log is legal only on classes and enums.
|
||||
4 error @Log is legal only on classes and enums.
|
||||
1 error @Slf4j is legal only on classes and enums.
|
||||
4 error @Slf4j is legal only on classes and enums.
|
||||
@@ -0,0 +1 @@
|
||||
2 error Getter cannot be resolved to a type
|
||||
@@ -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
|
||||
@@ -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 { ... })
|
||||
Reference in new issue
Block a user