-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
…oved
- Loading branch information
1 parent
af05813
commit f574fee
Showing
3 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
98 changes: 98 additions & 0 deletions
98
test/transform/resource/after-delombok/SingularCleanupForDelombok.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import java.util.Set; | ||
import lombok.NonNull; | ||
class Book { | ||
@NonNull | ||
private final String name; | ||
@NonNull | ||
private final Set<String> authors; | ||
private final int numberOfAuthors; | ||
public Book(String name, Set<String> authors) { | ||
this(name, authors, authors.size()); | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public static class BookBuilder { | ||
@java.lang.SuppressWarnings("all") | ||
private String name; | ||
@java.lang.SuppressWarnings("all") | ||
private java.util.ArrayList<String> authors; | ||
@java.lang.SuppressWarnings("all") | ||
BookBuilder() { | ||
} | ||
/** | ||
* @return {@code this}. | ||
*/ | ||
@java.lang.SuppressWarnings("all") | ||
public Book.BookBuilder name(final String name) { | ||
this.name = name; | ||
return this; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public Book.BookBuilder author(final String author) { | ||
if (this.authors == null) this.authors = new java.util.ArrayList<String>(); | ||
this.authors.add(author); | ||
return this; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public Book.BookBuilder authors(final java.util.Collection<? extends String> authors) { | ||
if (authors == null) { | ||
throw new java.lang.NullPointerException("authors cannot be null"); | ||
} | ||
if (this.authors == null) this.authors = new java.util.ArrayList<String>(); | ||
this.authors.addAll(authors); | ||
return this; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public Book.BookBuilder clearAuthors() { | ||
if (this.authors != null) this.authors.clear(); | ||
return this; | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public Book build() { | ||
java.util.Set<String> authors; | ||
switch (this.authors == null ? 0 : this.authors.size()) { | ||
case 0: | ||
authors = java.util.Collections.emptySet(); | ||
break; | ||
case 1: | ||
authors = java.util.Collections.singleton(this.authors.get(0)); | ||
break; | ||
default: | ||
authors = new java.util.LinkedHashSet<String>(this.authors.size() < 1073741824 ? 1 + this.authors.size() + (this.authors.size() - 3) / 3 : java.lang.Integer.MAX_VALUE); | ||
authors.addAll(this.authors); | ||
authors = java.util.Collections.unmodifiableSet(authors); | ||
} | ||
return new Book(this.name, authors); | ||
} | ||
@java.lang.Override | ||
@java.lang.SuppressWarnings("all") | ||
public java.lang.String toString() { | ||
return "Book.BookBuilder(name=" + this.name + ", authors=" + this.authors + ")"; | ||
} | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
public static Book.BookBuilder builder() { | ||
return new Book.BookBuilder(); | ||
} | ||
@java.lang.SuppressWarnings("all") | ||
Book(@NonNull final String name, @NonNull final Set<String> authors, final int numberOfAuthors) { | ||
if (name == null) { | ||
throw new java.lang.NullPointerException("name is marked non-null but is null"); | ||
} | ||
if (authors == null) { | ||
throw new java.lang.NullPointerException("authors is marked non-null but is null"); | ||
} | ||
this.name = name; | ||
this.authors = authors; | ||
this.numberOfAuthors = numberOfAuthors; | ||
} | ||
@NonNull | ||
@java.lang.SuppressWarnings("all") | ||
public String name() { | ||
return this.name; | ||
} | ||
@NonNull | ||
@java.lang.SuppressWarnings("all") | ||
public Set<String> authors() { | ||
return this.authors; | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
test/transform/resource/after-ecj/SingularCleanupForDelombok.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
// ignore: This tests specifically that delombok removes something; it does not apply to ecj |
23 changes: 23 additions & 0 deletions
23
test/transform/resource/before/SingularCleanupForDelombok.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// issue #1377: @Singular is not removed by delombok. | ||
|
||
import java.util.Set; | ||
|
||
import lombok.AccessLevel; | ||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NonNull; | ||
import lombok.Singular; | ||
|
||
import lombok.experimental.Accessors; | ||
import lombok.experimental.FieldDefaults; | ||
|
||
@Accessors(fluent = true) @AllArgsConstructor(access = AccessLevel.PACKAGE) @FieldDefaults(makeFinal = true, level = AccessLevel.PRIVATE) class Book { | ||
@Getter @NonNull String name; | ||
@Getter @Singular @NonNull Set<String> authors; | ||
int numberOfAuthors; | ||
|
||
@Builder public Book(String name, @Singular Set<String> authors) { | ||
this(name, authors, authors.size()); | ||
} | ||
} |