diff options
author | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-20 15:01:30 +0100 |
---|---|---|
committer | Reinier Zwitserloot <reinier@zwitserloot.com> | 2015-01-20 15:01:30 +0100 |
commit | 5b4ab9dae8940973ce8b87c8c2a0388b768dac89 (patch) | |
tree | 1c6b9f00f7e1ae5e7e0ec72b2b6e4d823ee911a8 /test/transform | |
parent | 857da88e3e2af440876bf79bebd6e32e55895cf8 (diff) | |
download | lombok-5b4ab9dae8940973ce8b87c8c2a0388b768dac89.tar.gz lombok-5b4ab9dae8940973ce8b87c8c2a0388b768dac89.tar.bz2 lombok-5b4ab9dae8940973ce8b87c8c2a0388b768dac89.zip |
added the ‘always use guava’ lombok.config option for @Singular @Builder.
Diffstat (limited to 'test/transform')
4 files changed, 159 insertions, 4 deletions
diff --git a/test/transform/resource/after-delombok/BuilderSingletonRedirectToGuava.java b/test/transform/resource/after-delombok/BuilderSingletonRedirectToGuava.java new file mode 100644 index 00000000..a2d230a1 --- /dev/null +++ b/test/transform/resource/after-delombok/BuilderSingletonRedirectToGuava.java @@ -0,0 +1,75 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +class BuilderSingletonRedirectToGuava { + private Set<String> dangerMice; + private NavigableMap<Integer, Number> things; + private Collection<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingletonRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + @java.lang.SuppressWarnings("all") + public static class BuilderSingletonRedirectToGuavaBuilder { + private com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") + BuilderSingletonRedirectToGuavaBuilder() { + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder dangerMouse(final String dangerMouse) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder dangerMice(final java.lang.Iterable<? extends String> dangerMice) { + if (this.dangerMice == null) this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder thing(final Integer thing$key, final Number thing$value) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(thing$key, thing$value); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder things(final java.util.Map<? extends Integer, ? extends Number> things) { + if (this.things == null) this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder doohickey(final Class<?> doohickey) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuavaBuilder doohickeys(final java.lang.Iterable<? extends Class<?>> doohickeys) { + if (this.doohickeys == null) this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + @java.lang.SuppressWarnings("all") + public BuilderSingletonRedirectToGuava build() { + java.util.Set<String> dangerMice = this.dangerMice == null ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build(); + java.util.NavigableMap<Integer, Number> things = this.things == null ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build(); + java.util.Collection<Class<?>> doohickeys = this.doohickeys == null ? com.google.common.collect.ImmutableList.of() : this.doohickeys.build(); + return new BuilderSingletonRedirectToGuava(dangerMice, things, doohickeys); + } + @java.lang.Override + @java.lang.SuppressWarnings("all") + public java.lang.String toString() { + return "BuilderSingletonRedirectToGuava.BuilderSingletonRedirectToGuavaBuilder(dangerMice=" + this.dangerMice + ", things=" + this.things + ", doohickeys=" + this.doohickeys + ")"; + } + } + @java.lang.SuppressWarnings("all") + public static BuilderSingletonRedirectToGuavaBuilder builder() { + return new BuilderSingletonRedirectToGuavaBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/after-ecj/BuilderSingletonRedirectToGuava.java b/test/transform/resource/after-ecj/BuilderSingletonRedirectToGuava.java new file mode 100644 index 00000000..ce8fab10 --- /dev/null +++ b/test/transform/resource/after-ecj/BuilderSingletonRedirectToGuava.java @@ -0,0 +1,71 @@ +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; +import lombok.Singular; +@lombok.Builder class BuilderSingletonRedirectToGuava { + public static @java.lang.SuppressWarnings("all") class BuilderSingletonRedirectToGuavaBuilder { + private com.google.common.collect.ImmutableSet.Builder<String> dangerMice; + private com.google.common.collect.ImmutableSortedMap.Builder<Integer, Number> things; + private com.google.common.collect.ImmutableList.Builder<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder() { + super(); + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder dangerMouse(String dangerMouse) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.add(dangerMouse); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder dangerMice(java.lang.Iterable<? extends String> dangerMice) { + if ((this.dangerMice == null)) + this.dangerMice = com.google.common.collect.ImmutableSet.builder(); + this.dangerMice.addAll(dangerMice); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder thing(Integer thing$key, Number thing$value) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.put(thing$key, thing$value); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder things(java.util.Map<? extends Integer, ? extends Number> things) { + if ((this.things == null)) + this.things = com.google.common.collect.ImmutableSortedMap.naturalOrder(); + this.things.putAll(things); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder doohickey(Class<?> doohickey) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.add(doohickey); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder doohickeys(java.lang.Iterable<? extends Class<?>> doohickeys) { + if ((this.doohickeys == null)) + this.doohickeys = com.google.common.collect.ImmutableList.builder(); + this.doohickeys.addAll(doohickeys); + return this; + } + public @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuava build() { + java.util.Set<String> dangerMice = ((this.dangerMice == null) ? com.google.common.collect.ImmutableSet.of() : this.dangerMice.build()); + java.util.NavigableMap<Integer, Number> things = ((this.things == null) ? com.google.common.collect.ImmutableSortedMap.of() : this.things.build()); + java.util.Collection<Class<?>> doohickeys = ((this.doohickeys == null) ? com.google.common.collect.ImmutableList.of() : this.doohickeys.build()); + return new BuilderSingletonRedirectToGuava(dangerMice, things, doohickeys); + } + public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() { + return (((((("BuilderSingletonRedirectToGuava.BuilderSingletonRedirectToGuavaBuilder(dangerMice=" + this.dangerMice) + ", things=") + this.things) + ", doohickeys=") + this.doohickeys) + ")"); + } + } + private @Singular Set<String> dangerMice; + private @Singular NavigableMap<Integer, Number> things; + private @Singular Collection<Class<?>> doohickeys; + @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuava(final Set<String> dangerMice, final NavigableMap<Integer, Number> things, final Collection<Class<?>> doohickeys) { + super(); + this.dangerMice = dangerMice; + this.things = things; + this.doohickeys = doohickeys; + } + public static @java.lang.SuppressWarnings("all") BuilderSingletonRedirectToGuavaBuilder builder() { + return new BuilderSingletonRedirectToGuavaBuilder(); + } +}
\ No newline at end of file diff --git a/test/transform/resource/before/BuilderSingletonRedirectToGuava.java b/test/transform/resource/before/BuilderSingletonRedirectToGuava.java new file mode 100644 index 00000000..0429f0ed --- /dev/null +++ b/test/transform/resource/before/BuilderSingletonRedirectToGuava.java @@ -0,0 +1,13 @@ +//CONF: lombok.builder.useGuava = true +import java.util.Set; +import java.util.NavigableMap; +import java.util.Collection; + +import lombok.Singular; + +@lombok.Builder +class BuilderSingletonRedirectToGuava { + @Singular private Set<String> dangerMice; + @Singular private NavigableMap<Integer, Number> things; + @Singular private Collection<Class<?>> doohickeys; +} diff --git a/test/transform/src/lombok/transform/TestWithEcj.java b/test/transform/src/lombok/transform/TestWithEcj.java index 4c3f6bf8..0a4057dd 100644 --- a/test/transform/src/lombok/transform/TestWithEcj.java +++ b/test/transform/src/lombok/transform/TestWithEcj.java @@ -57,8 +57,4 @@ public class TestWithEcj extends DirectoryRunner.TestParams { public File getMessagesDirectory() { return new File("test/transform/resource/messages-ecj"); } - - @Override public boolean accept(File file) { - return file.getName().startsWith("BuilderSingleton"); - } } |