diff options
Diffstat (limited to 'usage_examples')
-rw-r--r-- | usage_examples/BuilderExample_post.jpage | 2 | ||||
-rw-r--r-- | usage_examples/DataExample_post.jpage | 6 | ||||
-rw-r--r-- | usage_examples/EqualsAndHashCodeExample_post.jpage | 2 | ||||
-rw-r--r-- | usage_examples/ValueExample_post.jpage | 6 | ||||
-rw-r--r-- | usage_examples/experimental/HelperExample_post.jpage | 14 | ||||
-rw-r--r-- | usage_examples/experimental/HelperExample_pre.jpage | 15 |
6 files changed, 37 insertions, 8 deletions
diff --git a/usage_examples/BuilderExample_post.jpage b/usage_examples/BuilderExample_post.jpage index 863ab19b..8a1d1e69 100644 --- a/usage_examples/BuilderExample_post.jpage +++ b/usage_examples/BuilderExample_post.jpage @@ -53,7 +53,7 @@ public class BuilderExample { public BuilderExample build() { // complicated switch statement to produce a compact properly sized immutable set omitted. - // go to http://projectlombok.org/features/Singular-snippet.html to see it. + // go to https://projectlombok.org/features/Singular-snippet.html to see it. Set<String> occupations = ...; return new BuilderExample(name, age, occupations); } diff --git a/usage_examples/DataExample_post.jpage b/usage_examples/DataExample_post.jpage index e53e999c..bef0a0f1 100644 --- a/usage_examples/DataExample_post.jpage +++ b/usage_examples/DataExample_post.jpage @@ -62,7 +62,7 @@ public class DataExample { final int PRIME = 59; int result = 1; final long temp1 = Double.doubleToLongBits(this.getScore()); - result = (result*PRIME) + (this.getName() == null ? 0 : this.getName().hashCode()); + result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode()); result = (result*PRIME) + this.getAge(); result = (result*PRIME) + (int)(temp1 ^ (temp1 >>> 32)); result = (result*PRIME) + Arrays.deepHashCode(this.getTags()); @@ -111,8 +111,8 @@ public class DataExample { @Override public int hashCode() { final int PRIME = 59; int result = 1; - result = (result*PRIME) + (this.getName() == null ? 0 : this.getName().hashCode()); - result = (result*PRIME) + (this.getValue() == null ? 0 : this.getValue().hashCode()); + result = (result*PRIME) + (this.getName() == null ? 43 : this.getName().hashCode()); + result = (result*PRIME) + (this.getValue() == null ? 43 : this.getValue().hashCode()); return result; } } diff --git a/usage_examples/EqualsAndHashCodeExample_post.jpage b/usage_examples/EqualsAndHashCodeExample_post.jpage index f58e045b..91e78250 100644 --- a/usage_examples/EqualsAndHashCodeExample_post.jpage +++ b/usage_examples/EqualsAndHashCodeExample_post.jpage @@ -27,7 +27,7 @@ public class EqualsAndHashCodeExample { final int PRIME = 59; int result = 1; final long temp1 = Double.doubleToLongBits(this.score); - result = (result*PRIME) + (this.name == null ? 0 : this.name.hashCode()); + result = (result*PRIME) + (this.name == null ? 43 : this.name.hashCode()); result = (result*PRIME) + (int)(temp1 ^ (temp1 >>> 32)); result = (result*PRIME) + Arrays.deepHashCode(this.tags); return result; diff --git a/usage_examples/ValueExample_post.jpage b/usage_examples/ValueExample_post.jpage index 4ac8654e..8a5d4836 100644 --- a/usage_examples/ValueExample_post.jpage +++ b/usage_examples/ValueExample_post.jpage @@ -49,7 +49,7 @@ public final class ValueExample { final int PRIME = 59; int result = 1; final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 0 : $name.hashCode()); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); result = result * PRIME + this.getAge(); final long $score = Double.doubleToLongBits(this.getScore()); result = result * PRIME + (int)($score >>> 32 ^ $score); @@ -106,9 +106,9 @@ public final class ValueExample { final int PRIME = 59; int result = 1; final Object $name = this.getName(); - result = result * PRIME + ($name == null ? 0 : $name.hashCode()); + result = result * PRIME + ($name == null ? 43 : $name.hashCode()); final Object $value = this.getValue(); - result = result * PRIME + ($value == null ? 0 : $value.hashCode()); + result = result * PRIME + ($value == null ? 43 : $value.hashCode()); return result; } diff --git a/usage_examples/experimental/HelperExample_post.jpage b/usage_examples/experimental/HelperExample_post.jpage new file mode 100644 index 00000000..04a97b9f --- /dev/null +++ b/usage_examples/experimental/HelperExample_post.jpage @@ -0,0 +1,14 @@ +public class HelperExample { + int someMethod(int arg1) { + int localVar = 5; + + class Helpers { + int helperMethod(int arg) { + return arg + localVar; + } + } + Helpers $Helpers = new Helpers(); + + return $Helpers.helperMethod(10); + } +} diff --git a/usage_examples/experimental/HelperExample_pre.jpage b/usage_examples/experimental/HelperExample_pre.jpage new file mode 100644 index 00000000..cd86ef3c --- /dev/null +++ b/usage_examples/experimental/HelperExample_pre.jpage @@ -0,0 +1,15 @@ +import lombok.experimental.Helper; + +public class HelperExample { + int someMethod(int arg1) { + int localVar = 5; + + @Helper class Helpers { + int helperMethod(int arg) { + return arg + localVar; + } + } + + return helperMethod(10); + } +} |