aboutsummaryrefslogtreecommitdiff
path: root/test/transform/resource
diff options
context:
space:
mode:
authordaliclass <markhaynes.work@gmail.com>2019-05-05 22:28:48 +0100
committerRoel Spilker <r.spilker@gmail.com>2019-05-07 15:18:01 +0200
commitd3ae4d994880a1a087108275e101ab4fbb43f071 (patch)
treef9cbadfbe9df076904e5a3cd0680ddc3ec54d3e4 /test/transform/resource
parent3496a3e9633cd6526745bcc390877653afad7f09 (diff)
downloadlombok-d3ae4d994880a1a087108275e101ab4fbb43f071.tar.gz
lombok-d3ae4d994880a1a087108275e101ab4fbb43f071.tar.bz2
lombok-d3ae4d994880a1a087108275e101ab4fbb43f071.zip
[Feature] staticConstructor should use already defined private constructor if available
Diffstat (limited to 'test/transform/resource')
-rw-r--r--test/transform/resource/after-delombok/ValueStaticConstructorOf.java50
-rw-r--r--test/transform/resource/after-ecj/ValueStaticConstructorOf.java47
-rw-r--r--test/transform/resource/before/ValueStaticConstructorOf.java12
3 files changed, 109 insertions, 0 deletions
diff --git a/test/transform/resource/after-delombok/ValueStaticConstructorOf.java b/test/transform/resource/after-delombok/ValueStaticConstructorOf.java
new file mode 100644
index 00000000..fe75f823
--- /dev/null
+++ b/test/transform/resource/after-delombok/ValueStaticConstructorOf.java
@@ -0,0 +1,50 @@
+public final class ValueStaticConstructorOf {
+ private final String name;
+ private final Double price;
+ private ValueStaticConstructorOf(String name, Double price) {
+ this.name = name;
+ this.price = price;
+ }
+ @java.lang.SuppressWarnings("all")
+ public static ValueStaticConstructorOf of(final String name, final Double price) {
+ return new ValueStaticConstructorOf(name, price);
+ }
+ @java.lang.SuppressWarnings("all")
+ public String getName() {
+ return this.name;
+ }
+ @java.lang.SuppressWarnings("all")
+ public Double getPrice() {
+ return this.price;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public boolean equals(final java.lang.Object o) {
+ if (o == this) return true;
+ if (!(o instanceof ValueStaticConstructorOf)) return false;
+ final ValueStaticConstructorOf other = (ValueStaticConstructorOf) o;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (this$name == null ? other$name != null : !this$name.equals(other$name)) return false;
+ final java.lang.Object this$price = this.getPrice();
+ final java.lang.Object other$price = other.getPrice();
+ if (this$price == null ? other$price != null : !this$price.equals(other$price)) return false;
+ return true;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $name = this.getName();
+ result = result * PRIME + ($name == null ? 43 : $name.hashCode());
+ final java.lang.Object $price = this.getPrice();
+ result = result * PRIME + ($price == null ? 43 : $price.hashCode());
+ return result;
+ }
+ @java.lang.Override
+ @java.lang.SuppressWarnings("all")
+ public java.lang.String toString() {
+ return "ValueStaticConstructorOf(name=" + this.getName() + ", price=" + this.getPrice() + ")";
+ }
+}
diff --git a/test/transform/resource/after-ecj/ValueStaticConstructorOf.java b/test/transform/resource/after-ecj/ValueStaticConstructorOf.java
new file mode 100644
index 00000000..6cf71ed4
--- /dev/null
+++ b/test/transform/resource/after-ecj/ValueStaticConstructorOf.java
@@ -0,0 +1,47 @@
+import lombok.Value;
+public final @Value(staticConstructor = "of") class ValueStaticConstructorOf {
+ private final String name;
+ private final Double price;
+ private ValueStaticConstructorOf(String name, Double price) {
+ super();
+ this.name = name;
+ this.price = price;
+ }
+ public @java.lang.SuppressWarnings("all") String getName() {
+ return this.name;
+ }
+ public @java.lang.SuppressWarnings("all") Double getPrice() {
+ return this.price;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) {
+ if ((o == this))
+ return true;
+ if ((! (o instanceof ValueStaticConstructorOf)))
+ return false;
+ final ValueStaticConstructorOf other = (ValueStaticConstructorOf) o;
+ final java.lang.Object this$name = this.getName();
+ final java.lang.Object other$name = other.getName();
+ if (((this$name == null) ? (other$name != null) : (! this$name.equals(other$name))))
+ return false;
+ final java.lang.Object this$price = this.getPrice();
+ final java.lang.Object other$price = other.getPrice();
+ if (((this$price == null) ? (other$price != null) : (! this$price.equals(other$price))))
+ return false;
+ return true;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") int hashCode() {
+ final int PRIME = 59;
+ int result = 1;
+ final java.lang.Object $name = this.getName();
+ result = ((result * PRIME) + (($name == null) ? 43 : $name.hashCode()));
+ final java.lang.Object $price = this.getPrice();
+ result = ((result * PRIME) + (($price == null) ? 43 : $price.hashCode()));
+ return result;
+ }
+ public @java.lang.Override @java.lang.SuppressWarnings("all") java.lang.String toString() {
+ return (((("ValueStaticConstructorOf(name=" + this.getName()) + ", price=") + this.getPrice()) + ")");
+ }
+ public static @java.lang.SuppressWarnings("all") ValueStaticConstructorOf of(final String name, final Double price) {
+ return new ValueStaticConstructorOf(name, price);
+ }
+} \ No newline at end of file
diff --git a/test/transform/resource/before/ValueStaticConstructorOf.java b/test/transform/resource/before/ValueStaticConstructorOf.java
new file mode 100644
index 00000000..ac857ffd
--- /dev/null
+++ b/test/transform/resource/before/ValueStaticConstructorOf.java
@@ -0,0 +1,12 @@
+import lombok.Value;
+@Value(staticConstructor = "of")
+public class ValueStaticConstructorOf {
+
+ String name;
+ Double price;
+
+ private ValueStaticConstructorOf(String name, Double price) {
+ this.name = name;
+ this.price = price;
+ }
+}