mirror of
https://github.com/tiennm99/lombok.git
synced 2026-10-13 02:14:44 +00:00
fixed type mismatch in lazy getter example (issue 223)
note: this example shows how lazy getter would work once issue 160 is no more
This commit is contained in:
1 parent
865b7dbc6a
commit
917518bbea
2 files changed
+5
-5
No files matched your search
@@ -1,9 +1,9 @@
|
||||
public class GetterLazyExample {
|
||||
private int[] $lombok$lazy1v;
|
||||
private double[] $lombok$lazy1v;
|
||||
private volatile boolean $lombok$lazy1i;
|
||||
private final Object $lombok$lazyLock = new Object[0];
|
||||
|
||||
public int[] getCached() {
|
||||
public double[] getCached() {
|
||||
if (!this.$lombok$lazy1i) {
|
||||
synchronized (this.$lombok$lazyLock) {
|
||||
if (!this.$lombok$lazy1i) {
|
||||
@@ -15,7 +15,7 @@ public class GetterLazyExample {
|
||||
return this.$lombok$lazy1v;
|
||||
}
|
||||
|
||||
private int[] expensive() {
|
||||
private double[] expensive() {
|
||||
double[] result = new double[1000000];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = Math.asin(i);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import lombok.Getter;
|
||||
|
||||
public class GetterLazyExample {
|
||||
@Getter(lazy=true) private final int[] cached = expensive();
|
||||
@Getter(lazy=true) private final double[] cached = expensive();
|
||||
|
||||
private int[] expensive() {
|
||||
private double[] expensive() {
|
||||
double[] result = new double[1000000];
|
||||
for (int i = 0; i < result.length; i++) {
|
||||
result[i] = Math.asin(i);
|
||||
|
||||
Reference in new issue
Block a user