From 40f464503f6a41240b417317bef57f757b048bf5 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Sun, 14 Jan 2024 10:58:47 +0100 Subject: [PATCH] [fixes #2917] Use $value instead of value in lazy getter --- .../lombok/eclipse/handlers/HandleGetter.java | 4 +- .../lombok/javac/handlers/HandleGetter.java | 4 +- .../after-delombok/DelegateOnGetter.java | 14 +- .../resource/after-delombok/GetterLazy.java | 14 +- .../after-delombok/GetterLazyArguments.java | 84 ++++++------ .../after-delombok/GetterLazyBoolean.java | 28 ++-- .../GetterLazyEahcToString.java | 14 +- .../GetterLazyErrorPosition.java | 14 +- .../after-delombok/GetterLazyGenerics.java | 28 ++-- .../GetterLazyInAnonymousClass.java | 14 +- .../after-delombok/GetterLazyNative.java | 126 +++++++++--------- .../after-delombok/GetterLazyTransient.java | 14 +- .../after-delombok/SkipSuppressWarnings.java | 14 +- .../resource/after-ecj/DelegateOnGetter.java | 14 +- .../resource/after-ecj/GetterLazy.java | 14 +- .../after-ecj/GetterLazyArguments.java | 84 ++++++------ .../resource/after-ecj/GetterLazyBoolean.java | 28 ++-- .../after-ecj/GetterLazyEahcToString.java | 14 +- .../after-ecj/GetterLazyGenerics.java | 28 ++-- .../after-ecj/GetterLazyInAnonymousClass.java | 14 +- .../resource/after-ecj/GetterLazyNative.java | 126 +++++++++--------- .../after-ecj/GetterLazyTransient.java | 14 +- .../after-ecj/SkipSuppressWarnings.java | 14 +- 23 files changed, 361 insertions(+), 361 deletions(-) diff --git a/src/core/lombok/eclipse/handlers/HandleGetter.java b/src/core/lombok/eclipse/handlers/HandleGetter.java index 2d8b112f47..5ed2c2d94f 100644 --- a/src/core/lombok/eclipse/handlers/HandleGetter.java +++ b/src/core/lombok/eclipse/handlers/HandleGetter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2022 The Project Lombok Authors. + * Copyright (C) 2009-2024 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -323,7 +323,7 @@ public Statement[] createSimpleGetterBody(ASTNode source, EclipseNode fieldNode) TYPE_MAP = Collections.unmodifiableMap(m); } - private static char[] valueName = "value".toCharArray(); + private static char[] valueName = "$value".toCharArray(); private static char[] actualValueName = "actualValue".toCharArray(); private static final int PARENTHESIZED = (1 << ASTNode.ParenthesizedSHIFT) & ASTNode.ParenthesizedMASK; diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java index 153a220134..dac524dd3b 100644 --- a/src/core/lombok/javac/handlers/HandleGetter.java +++ b/src/core/lombok/javac/handlers/HandleGetter.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2009-2022 The Project Lombok Authors. + * Copyright (C) 2009-2024 The Project Lombok Authors. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -358,7 +358,7 @@ public List createLazyGetterBody(JavacTreeMaker maker, JavacNode fi } if (copyOfBoxedFieldType == null) copyOfBoxedFieldType = copyType(maker, field, source); - Name valueName = fieldNode.toName("value"); + Name valueName = fieldNode.toName("$value"); Name actualValueName = fieldNode.toName("actualValue"); /* java.lang.Object value = this.fieldName.get();*/ { diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java index edf1641bfd..76794085e3 100644 --- a/test/transform/resource/after-delombok/DelegateOnGetter.java +++ b/test/transform/resource/after-delombok/DelegateOnGetter.java @@ -6,11 +6,11 @@ private interface Bar { } @java.lang.SuppressWarnings({"all", "unchecked"}) public Bar getBar() { - java.lang.Object value = this.bar.get(); - if (value == null) { + java.lang.Object $value = this.bar.get(); + if ($value == null) { synchronized (this.bar) { - value = this.bar.get(); - if (value == null) { + $value = this.bar.get(); + if ($value == null) { final Bar actualValue = new Bar() { public void setList(java.util.ArrayList list) { } @@ -18,12 +18,12 @@ public int getInt() { return 42; } }; - value = actualValue == null ? this.bar : actualValue; - this.bar.set(value); + $value = actualValue == null ? this.bar : actualValue; + this.bar.set($value); } } } - return (Bar) (value == this.bar ? null : value); + return (Bar) ($value == this.bar ? null : $value); } @java.lang.SuppressWarnings("all") public void setList(final java.util.ArrayList list) { diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java index 1e30f94b44..8e1300be1b 100644 --- a/test/transform/resource/after-delombok/GetterLazy.java +++ b/test/transform/resource/after-delombok/GetterLazy.java @@ -4,17 +4,17 @@ static class ValueType { private final java.util.concurrent.atomic.AtomicReference fieldName = new java.util.concurrent.atomic.AtomicReference(); @java.lang.SuppressWarnings({"all", "unchecked"}) public ValueType getFieldName() { - java.lang.Object value = this.fieldName.get(); - if (value == null) { + java.lang.Object $value = this.fieldName.get(); + if ($value == null) { synchronized (this.fieldName) { - value = this.fieldName.get(); - if (value == null) { + $value = this.fieldName.get(); + if ($value == null) { final ValueType actualValue = new ValueType(); - value = actualValue == null ? this.fieldName : actualValue; - this.fieldName.set(value); + $value = actualValue == null ? this.fieldName : actualValue; + this.fieldName.set($value); } } } - return (ValueType) (value == this.fieldName ? null : value); + return (ValueType) ($value == this.fieldName ? null : $value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyArguments.java b/test/transform/resource/after-delombok/GetterLazyArguments.java index ef3f341c31..00b17f5c80 100644 --- a/test/transform/resource/after-delombok/GetterLazyArguments.java +++ b/test/transform/resource/after-delombok/GetterLazyArguments.java @@ -21,99 +21,99 @@ static String stringRunnable(String arg1, Runnable arg2) { @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField1() { - java.lang.Object value = this.field1.get(); - if (value == null) { + java.lang.Object $value = this.field1.get(); + if ($value == null) { synchronized (this.field1) { - value = this.field1.get(); - if (value == null) { + $value = this.field1.get(); + if ($value == null) { final String actualValue = stringInt(("a"), (1)); - value = actualValue == null ? this.field1 : actualValue; - this.field1.set(value); + $value = actualValue == null ? this.field1 : actualValue; + this.field1.set($value); } } } - return (String) (value == this.field1 ? null : value); + return (String) ($value == this.field1 ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField2() { - java.lang.Object value = this.field2.get(); - if (value == null) { + java.lang.Object $value = this.field2.get(); + if ($value == null) { synchronized (this.field2) { - value = this.field2.get(); - if (value == null) { + $value = this.field2.get(); + if ($value == null) { final String actualValue = stringInt(true ? "a" : "b", true ? 1 : 0); - value = actualValue == null ? this.field2 : actualValue; - this.field2.set(value); + $value = actualValue == null ? this.field2 : actualValue; + this.field2.set($value); } } } - return (String) (value == this.field2 ? null : value); + return (String) ($value == this.field2 ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField3() { - java.lang.Object value = this.field3.get(); - if (value == null) { + java.lang.Object $value = this.field3.get(); + if ($value == null) { synchronized (this.field3) { - value = this.field3.get(); - if (value == null) { + $value = this.field3.get(); + if ($value == null) { final String actualValue = stringInt(("a"), true ? 1 : 0); - value = actualValue == null ? this.field3 : actualValue; - this.field3.set(value); + $value = actualValue == null ? this.field3 : actualValue; + this.field3.set($value); } } } - return (String) (value == this.field3 ? null : value); + return (String) ($value == this.field3 ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField4() { - java.lang.Object value = this.field4.get(); - if (value == null) { + java.lang.Object $value = this.field4.get(); + if ($value == null) { synchronized (this.field4) { - value = this.field4.get(); - if (value == null) { + $value = this.field4.get(); + if ($value == null) { final String actualValue = stringRunnable(fun(), () -> { }); - value = actualValue == null ? this.field4 : actualValue; - this.field4.set(value); + $value = actualValue == null ? this.field4 : actualValue; + this.field4.set($value); } } } - return (String) (value == this.field4 ? null : value); + return (String) ($value == this.field4 ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField5() { - java.lang.Object value = this.field5.get(); - if (value == null) { + java.lang.Object $value = this.field5.get(); + if ($value == null) { synchronized (this.field5) { - value = this.field5.get(); - if (value == null) { + $value = this.field5.get(); + if ($value == null) { final String actualValue = stringRunnable(("a"), () -> { }); - value = actualValue == null ? this.field5 : actualValue; - this.field5.set(value); + $value = actualValue == null ? this.field5 : actualValue; + this.field5.set($value); } } } - return (String) (value == this.field5 ? null : value); + return (String) ($value == this.field5 ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField6() { - java.lang.Object value = this.field6.get(); - if (value == null) { + java.lang.Object $value = this.field6.get(); + if ($value == null) { synchronized (this.field6) { - value = this.field6.get(); - if (value == null) { + $value = this.field6.get(); + if ($value == null) { final String actualValue = true ? stringInt(true ? "a" : "b", true ? 1 : 0) : ""; - value = actualValue == null ? this.field6 : actualValue; - this.field6.set(value); + $value = actualValue == null ? this.field6 : actualValue; + this.field6.set($value); } } } - return (String) (value == this.field6 ? null : value); + return (String) ($value == this.field6 ? null : $value); } } \ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyBoolean.java b/test/transform/resource/after-delombok/GetterLazyBoolean.java index 5b1f19dcc4..495e6b9254 100644 --- a/test/transform/resource/after-delombok/GetterLazyBoolean.java +++ b/test/transform/resource/after-delombok/GetterLazyBoolean.java @@ -33,32 +33,32 @@ public java.lang.String toString() { } @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isBooleanValue() { - java.lang.Object value = this.booleanValue.get(); - if (value == null) { + java.lang.Object $value = this.booleanValue.get(); + if ($value == null) { synchronized (this.booleanValue) { - value = this.booleanValue.get(); - if (value == null) { + $value = this.booleanValue.get(); + if ($value == null) { final boolean actualValue = calculateBoolean(); - value = actualValue; - this.booleanValue.set(value); + $value = actualValue; + this.booleanValue.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isOtherBooleanValue() { - java.lang.Object value = this.otherBooleanValue.get(); - if (value == null) { + java.lang.Object $value = this.otherBooleanValue.get(); + if ($value == null) { synchronized (this.otherBooleanValue) { - value = this.otherBooleanValue.get(); - if (value == null) { + $value = this.otherBooleanValue.get(); + if ($value == null) { final boolean actualValue = !calculateBoolean(); - value = actualValue; - this.otherBooleanValue.set(value); + $value = actualValue; + this.otherBooleanValue.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } } diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java index bec89818fa..3742093ba4 100644 --- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java +++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java @@ -46,18 +46,18 @@ public java.lang.String toString() { @java.lang.SuppressWarnings({"all", "unchecked"}) public String getValue() { - java.lang.Object value = this.value.get(); - if (value == null) { + java.lang.Object $value = this.value.get(); + if ($value == null) { synchronized (this.value) { - value = this.value.get(); - if (value == null) { + $value = this.value.get(); + if ($value == null) { final String actualValue = ""; - value = actualValue == null ? this.value : actualValue; - this.value.set(value); + $value = actualValue == null ? this.value : actualValue; + this.value.set($value); } } } - return (String) (value == this.value ? null : value); + return (String) ($value == this.value ? null : $value); } @java.lang.SuppressWarnings("all") diff --git a/test/transform/resource/after-delombok/GetterLazyErrorPosition.java b/test/transform/resource/after-delombok/GetterLazyErrorPosition.java index 76797d4427..c901387690 100644 --- a/test/transform/resource/after-delombok/GetterLazyErrorPosition.java +++ b/test/transform/resource/after-delombok/GetterLazyErrorPosition.java @@ -3,17 +3,17 @@ class GetterLazyErrorPosition { @java.lang.SuppressWarnings({"all", "unchecked"}) public String getField() { - java.lang.Object value = this.field.get(); - if (value == null) { + java.lang.Object $value = this.field.get(); + if ($value == null) { synchronized (this.field) { - value = this.field.get(); - if (value == null) { + $value = this.field.get(); + if ($value == null) { final String actualValue = true ? "" : new ErrorPosition(); - value = actualValue == null ? this.field : actualValue; - this.field.set(value); + $value = actualValue == null ? this.field : actualValue; + this.field.set($value); } } } - return (String) (value == this.field ? null : value); + return (String) ($value == this.field ? null : $value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyGenerics.java b/test/transform/resource/after-delombok/GetterLazyGenerics.java index 5e92cda7a2..a8b8ff6c34 100644 --- a/test/transform/resource/after-delombok/GetterLazyGenerics.java +++ b/test/transform/resource/after-delombok/GetterLazyGenerics.java @@ -6,32 +6,32 @@ public static E getAny() { } @java.lang.SuppressWarnings({"all", "unchecked"}) public E getField() { - java.lang.Object value = this.field.get(); - if (value == null) { + java.lang.Object $value = this.field.get(); + if ($value == null) { synchronized (this.field) { - value = this.field.get(); - if (value == null) { + $value = this.field.get(); + if ($value == null) { final E actualValue = getAny(); - value = actualValue == null ? this.field : actualValue; - this.field.set(value); + $value = actualValue == null ? this.field : actualValue; + this.field.set($value); } } } - return (E) (value == this.field ? null : value); + return (E) ($value == this.field ? null : $value); } @java.lang.SuppressWarnings({"all", "unchecked"}) public long getField2() { - java.lang.Object value = this.field2.get(); - if (value == null) { + java.lang.Object $value = this.field2.get(); + if ($value == null) { synchronized (this.field2) { - value = this.field2.get(); - if (value == null) { + $value = this.field2.get(); + if ($value == null) { final long actualValue = System.currentTimeMillis(); - value = actualValue; - this.field2.set(value); + $value = actualValue; + this.field2.set($value); } } } - return (java.lang.Long) value; + return (java.lang.Long) $value; } } \ No newline at end of file diff --git a/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java b/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java index 4476e463bd..199437a11d 100644 --- a/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java +++ b/test/transform/resource/after-delombok/GetterLazyInAnonymousClass.java @@ -6,18 +6,18 @@ class Inner { @java.lang.SuppressWarnings({"all", "unchecked"}) public String getString() { - java.lang.Object value = this.string.get(); - if (value == null) { + java.lang.Object $value = this.string.get(); + if ($value == null) { synchronized (this.string) { - value = this.string.get(); - if (value == null) { + $value = this.string.get(); + if ($value == null) { final String actualValue = "test"; - value = actualValue == null ? this.string : actualValue; - this.string.set(value); + $value = actualValue == null ? this.string : actualValue; + this.string.set($value); } } } - return (String) (value == this.string ? null : value); + return (String) ($value == this.string ? null : $value); } } }; diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java index f43d54907c..a71a0354bc 100644 --- a/test/transform/resource/after-delombok/GetterLazyNative.java +++ b/test/transform/resource/after-delombok/GetterLazyNative.java @@ -10,137 +10,137 @@ class GetterLazyNative { private final java.util.concurrent.atomic.AtomicReference intArrayField = new java.util.concurrent.atomic.AtomicReference(); @java.lang.SuppressWarnings({"all", "unchecked"}) public boolean isBooleanField() { - java.lang.Object value = this.booleanField.get(); - if (value == null) { + java.lang.Object $value = this.booleanField.get(); + if ($value == null) { synchronized (this.booleanField) { - value = this.booleanField.get(); - if (value == null) { + $value = this.booleanField.get(); + if ($value == null) { final boolean actualValue = true; - value = actualValue; - this.booleanField.set(value); + $value = actualValue; + this.booleanField.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public byte getByteField() { - java.lang.Object value = this.byteField.get(); - if (value == null) { + java.lang.Object $value = this.byteField.get(); + if ($value == null) { synchronized (this.byteField) { - value = this.byteField.get(); - if (value == null) { + $value = this.byteField.get(); + if ($value == null) { final byte actualValue = 1; - value = actualValue; - this.byteField.set(value); + $value = actualValue; + this.byteField.set($value); } } } - return (java.lang.Byte) value; + return (java.lang.Byte) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public short getShortField() { - java.lang.Object value = this.shortField.get(); - if (value == null) { + java.lang.Object $value = this.shortField.get(); + if ($value == null) { synchronized (this.shortField) { - value = this.shortField.get(); - if (value == null) { + $value = this.shortField.get(); + if ($value == null) { final short actualValue = 1; - value = actualValue; - this.shortField.set(value); + $value = actualValue; + this.shortField.set($value); } } } - return (java.lang.Short) value; + return (java.lang.Short) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public int getIntField() { - java.lang.Object value = this.intField.get(); - if (value == null) { + java.lang.Object $value = this.intField.get(); + if ($value == null) { synchronized (this.intField) { - value = this.intField.get(); - if (value == null) { + $value = this.intField.get(); + if ($value == null) { final int actualValue = 1; - value = actualValue; - this.intField.set(value); + $value = actualValue; + this.intField.set($value); } } } - return (java.lang.Integer) value; + return (java.lang.Integer) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public long getLongField() { - java.lang.Object value = this.longField.get(); - if (value == null) { + java.lang.Object $value = this.longField.get(); + if ($value == null) { synchronized (this.longField) { - value = this.longField.get(); - if (value == null) { + $value = this.longField.get(); + if ($value == null) { final long actualValue = 1; - value = actualValue; - this.longField.set(value); + $value = actualValue; + this.longField.set($value); } } } - return (java.lang.Long) value; + return (java.lang.Long) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public float getFloatField() { - java.lang.Object value = this.floatField.get(); - if (value == null) { + java.lang.Object $value = this.floatField.get(); + if ($value == null) { synchronized (this.floatField) { - value = this.floatField.get(); - if (value == null) { + $value = this.floatField.get(); + if ($value == null) { final float actualValue = 1.0F; - value = actualValue; - this.floatField.set(value); + $value = actualValue; + this.floatField.set($value); } } } - return (java.lang.Float) value; + return (java.lang.Float) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public double getDoubleField() { - java.lang.Object value = this.doubleField.get(); - if (value == null) { + java.lang.Object $value = this.doubleField.get(); + if ($value == null) { synchronized (this.doubleField) { - value = this.doubleField.get(); - if (value == null) { + $value = this.doubleField.get(); + if ($value == null) { final double actualValue = 1.0; - value = actualValue; - this.doubleField.set(value); + $value = actualValue; + this.doubleField.set($value); } } } - return (java.lang.Double) value; + return (java.lang.Double) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public char getCharField() { - java.lang.Object value = this.charField.get(); - if (value == null) { + java.lang.Object $value = this.charField.get(); + if ($value == null) { synchronized (this.charField) { - value = this.charField.get(); - if (value == null) { + $value = this.charField.get(); + if ($value == null) { final char actualValue = '1'; - value = actualValue; - this.charField.set(value); + $value = actualValue; + this.charField.set($value); } } } - return (java.lang.Character) value; + return (java.lang.Character) $value; } @java.lang.SuppressWarnings({"all", "unchecked"}) public int[] getIntArrayField() { - java.lang.Object value = this.intArrayField.get(); - if (value == null) { + java.lang.Object $value = this.intArrayField.get(); + if ($value == null) { synchronized (this.intArrayField) { - value = this.intArrayField.get(); - if (value == null) { + $value = this.intArrayField.get(); + if ($value == null) { final int[] actualValue = new int[] {1}; - value = actualValue == null ? this.intArrayField : actualValue; - this.intArrayField.set(value); + $value = actualValue == null ? this.intArrayField : actualValue; + this.intArrayField.set($value); } } } - return (int[]) (value == this.intArrayField ? null : value); + return (int[]) ($value == this.intArrayField ? null : $value); } } diff --git a/test/transform/resource/after-delombok/GetterLazyTransient.java b/test/transform/resource/after-delombok/GetterLazyTransient.java index 0fd8562138..3d1a2be302 100644 --- a/test/transform/resource/after-delombok/GetterLazyTransient.java +++ b/test/transform/resource/after-delombok/GetterLazyTransient.java @@ -4,18 +4,18 @@ class GetterLazyTransient { private final transient int nonLazyTransientField = 3; @java.lang.SuppressWarnings({"all", "unchecked"}) public int getNonTransientField() { - java.lang.Object value = this.nonTransientField.get(); - if (value == null) { + java.lang.Object $value = this.nonTransientField.get(); + if ($value == null) { synchronized (this.nonTransientField) { - value = this.nonTransientField.get(); - if (value == null) { + $value = this.nonTransientField.get(); + if ($value == null) { final int actualValue = 1; - value = actualValue; - this.nonTransientField.set(value); + $value = actualValue; + this.nonTransientField.set($value); } } } - return (java.lang.Integer) value; + return (java.lang.Integer) $value; } @java.lang.SuppressWarnings("all") public int getNonLazyTransientField() { diff --git a/test/transform/resource/after-delombok/SkipSuppressWarnings.java b/test/transform/resource/after-delombok/SkipSuppressWarnings.java index 151d4e1772..77bfdcc463 100644 --- a/test/transform/resource/after-delombok/SkipSuppressWarnings.java +++ b/test/transform/resource/after-delombok/SkipSuppressWarnings.java @@ -8,17 +8,17 @@ public String getField() { @java.lang.SuppressWarnings({"unchecked"}) public String getField2() { - java.lang.Object value = this.field2.get(); - if (value == null) { + java.lang.Object $value = this.field2.get(); + if ($value == null) { synchronized (this.field2) { - value = this.field2.get(); - if (value == null) { + $value = this.field2.get(); + if ($value == null) { final String actualValue = ""; - value = actualValue == null ? this.field2 : actualValue; - this.field2.set(value); + $value = actualValue == null ? this.field2 : actualValue; + this.field2.set($value); } } } - return (String) (value == this.field2 ? null : value); + return (String) ($value == this.field2 ? null : $value); } } \ No newline at end of file diff --git a/test/transform/resource/after-ecj/DelegateOnGetter.java b/test/transform/resource/after-ecj/DelegateOnGetter.java index f2b9a6cd2f..c23ea91709 100644 --- a/test/transform/resource/after-ecj/DelegateOnGetter.java +++ b/test/transform/resource/after-ecj/DelegateOnGetter.java @@ -10,13 +10,13 @@ private interface Bar { super(); } public @Delegate @java.lang.SuppressWarnings({"all", "unchecked"}) Bar getBar() { - java.lang.Object value = this.bar.get(); - if ((value == null)) + java.lang.Object $value = this.bar.get(); + if (($value == null)) { synchronized (this.bar) { - value = this.bar.get(); - if ((value == null)) + $value = this.bar.get(); + if (($value == null)) { final Bar actualValue = new Bar() { x() { @@ -28,12 +28,12 @@ public int getInt() { return 42; } }; - value = ((actualValue == null) ? this.bar : actualValue); - this.bar.set(value); + $value = ((actualValue == null) ? this.bar : actualValue); + this.bar.set($value); } } } - return (Bar) ((value == this.bar) ? null : value); + return (Bar) (($value == this.bar) ? null : $value); } public @java.lang.SuppressWarnings("all") int getInt() { return this.getBar().getInt(); diff --git a/test/transform/resource/after-ecj/GetterLazy.java b/test/transform/resource/after-ecj/GetterLazy.java index b4567f04f6..7627ab1688 100644 --- a/test/transform/resource/after-ecj/GetterLazy.java +++ b/test/transform/resource/after-ecj/GetterLazy.java @@ -9,20 +9,20 @@ static class ValueType { super(); } public @java.lang.SuppressWarnings({"all", "unchecked"}) ValueType getFieldName() { - java.lang.Object value = this.fieldName.get(); - if ((value == null)) + java.lang.Object $value = this.fieldName.get(); + if (($value == null)) { synchronized (this.fieldName) { - value = this.fieldName.get(); - if ((value == null)) + $value = this.fieldName.get(); + if (($value == null)) { final ValueType actualValue = new ValueType(); - value = ((actualValue == null) ? this.fieldName : actualValue); - this.fieldName.set(value); + $value = ((actualValue == null) ? this.fieldName : actualValue); + this.fieldName.set($value); } } } - return (ValueType) ((value == this.fieldName) ? null : value); + return (ValueType) (($value == this.fieldName) ? null : $value); } } diff --git a/test/transform/resource/after-ecj/GetterLazyArguments.java b/test/transform/resource/after-ecj/GetterLazyArguments.java index 14086d8192..bb51c4fc1f 100644 --- a/test/transform/resource/after-ecj/GetterLazyArguments.java +++ b/test/transform/resource/after-ecj/GetterLazyArguments.java @@ -18,107 +18,107 @@ static String stringRunnable(String arg1, Runnable arg2) { return null; } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField1() { - java.lang.Object value = this.field1.get(); - if ((value == null)) + java.lang.Object $value = this.field1.get(); + if (($value == null)) { synchronized (this.field1) { - value = this.field1.get(); - if ((value == null)) + $value = this.field1.get(); + if (($value == null)) { final String actualValue = stringInt("a", 1); - value = ((actualValue == null) ? this.field1 : actualValue); - this.field1.set(value); + $value = ((actualValue == null) ? this.field1 : actualValue); + this.field1.set($value); } } } - return (String) ((value == this.field1) ? null : value); + return (String) (($value == this.field1) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField2() { - java.lang.Object value = this.field2.get(); - if ((value == null)) + java.lang.Object $value = this.field2.get(); + if (($value == null)) { synchronized (this.field2) { - value = this.field2.get(); - if ((value == null)) + $value = this.field2.get(); + if (($value == null)) { final String actualValue = stringInt((true ? "a" : "b"), (true ? 1 : 0)); - value = ((actualValue == null) ? this.field2 : actualValue); - this.field2.set(value); + $value = ((actualValue == null) ? this.field2 : actualValue); + this.field2.set($value); } } } - return (String) ((value == this.field2) ? null : value); + return (String) (($value == this.field2) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField3() { - java.lang.Object value = this.field3.get(); - if ((value == null)) + java.lang.Object $value = this.field3.get(); + if (($value == null)) { synchronized (this.field3) { - value = this.field3.get(); - if ((value == null)) + $value = this.field3.get(); + if (($value == null)) { final String actualValue = stringInt("a", (true ? 1 : 0)); - value = ((actualValue == null) ? this.field3 : actualValue); - this.field3.set(value); + $value = ((actualValue == null) ? this.field3 : actualValue); + this.field3.set($value); } } } - return (String) ((value == this.field3) ? null : value); + return (String) (($value == this.field3) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField4() { - java.lang.Object value = this.field4.get(); - if ((value == null)) + java.lang.Object $value = this.field4.get(); + if (($value == null)) { synchronized (this.field4) { - value = this.field4.get(); - if ((value == null)) + $value = this.field4.get(); + if (($value == null)) { final String actualValue = stringRunnable(fun(), () -> { }); - value = ((actualValue == null) ? this.field4 : actualValue); - this.field4.set(value); + $value = ((actualValue == null) ? this.field4 : actualValue); + this.field4.set($value); } } } - return (String) ((value == this.field4) ? null : value); + return (String) (($value == this.field4) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField5() { - java.lang.Object value = this.field5.get(); - if ((value == null)) + java.lang.Object $value = this.field5.get(); + if (($value == null)) { synchronized (this.field5) { - value = this.field5.get(); - if ((value == null)) + $value = this.field5.get(); + if (($value == null)) { final String actualValue = stringRunnable("a", () -> { }); - value = ((actualValue == null) ? this.field5 : actualValue); - this.field5.set(value); + $value = ((actualValue == null) ? this.field5 : actualValue); + this.field5.set($value); } } } - return (String) ((value == this.field5) ? null : value); + return (String) (($value == this.field5) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getField6() { - java.lang.Object value = this.field6.get(); - if ((value == null)) + java.lang.Object $value = this.field6.get(); + if (($value == null)) { synchronized (this.field6) { - value = this.field6.get(); - if ((value == null)) + $value = this.field6.get(); + if (($value == null)) { final String actualValue = (true ? stringInt((true ? "a" : "b"), (true ? 1 : 0)) : ""); - value = ((actualValue == null) ? this.field6 : actualValue); - this.field6.set(value); + $value = ((actualValue == null) ? this.field6 : actualValue); + this.field6.set($value); } } } - return (String) ((value == this.field6) ? null : value); + return (String) (($value == this.field6) ? null : $value); } } \ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyBoolean.java b/test/transform/resource/after-ecj/GetterLazyBoolean.java index ad319755fd..40ecb856de 100644 --- a/test/transform/resource/after-ecj/GetterLazyBoolean.java +++ b/test/transform/resource/after-ecj/GetterLazyBoolean.java @@ -8,38 +8,38 @@ private static boolean calculateBoolean() { return true; } public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isBooleanValue() { - java.lang.Object value = this.booleanValue.get(); - if ((value == null)) + java.lang.Object $value = this.booleanValue.get(); + if (($value == null)) { synchronized (this.booleanValue) { - value = this.booleanValue.get(); - if ((value == null)) + $value = this.booleanValue.get(); + if (($value == null)) { final boolean actualValue = calculateBoolean(); - value = actualValue; - this.booleanValue.set(value); + $value = actualValue; + this.booleanValue.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isOtherBooleanValue() { - java.lang.Object value = this.otherBooleanValue.get(); - if ((value == null)) + java.lang.Object $value = this.otherBooleanValue.get(); + if (($value == null)) { synchronized (this.otherBooleanValue) { - value = this.otherBooleanValue.get(); - if ((value == null)) + $value = this.otherBooleanValue.get(); + if (($value == null)) { final boolean actualValue = (! calculateBoolean()); - value = actualValue; - this.otherBooleanValue.set(value); + $value = actualValue; + this.otherBooleanValue.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } public @java.lang.Override @java.lang.SuppressWarnings("all") boolean equals(final java.lang.Object o) { if ((o == this)) diff --git a/test/transform/resource/after-ecj/GetterLazyEahcToString.java b/test/transform/resource/after-ecj/GetterLazyEahcToString.java index 5197f4e145..f4f4ed37bd 100644 --- a/test/transform/resource/after-ecj/GetterLazyEahcToString.java +++ b/test/transform/resource/after-ecj/GetterLazyEahcToString.java @@ -5,21 +5,21 @@ super(); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getValue() { - java.lang.Object value = this.value.get(); - if ((value == null)) + java.lang.Object $value = this.value.get(); + if (($value == null)) { synchronized (this.value) { - value = this.value.get(); - if ((value == null)) + $value = this.value.get(); + if (($value == null)) { final String actualValue = ""; - value = ((actualValue == null) ? this.value : actualValue); - this.value.set(value); + $value = ((actualValue == null) ? this.value : actualValue); + this.value.set($value); } } } - return (String) ((value == this.value) ? null : value); + return (String) (($value == this.value) ? null : $value); } public @java.lang.SuppressWarnings("all") String getValue2() { return this.value2; diff --git a/test/transform/resource/after-ecj/GetterLazyGenerics.java b/test/transform/resource/after-ecj/GetterLazyGenerics.java index 67ef55434c..3a2a06c1ae 100644 --- a/test/transform/resource/after-ecj/GetterLazyGenerics.java +++ b/test/transform/resource/after-ecj/GetterLazyGenerics.java @@ -8,37 +8,37 @@ public static E getAny() { return null; } public @java.lang.SuppressWarnings({"all", "unchecked"}) E getField() { - java.lang.Object value = this.field.get(); - if ((value == null)) + java.lang.Object $value = this.field.get(); + if (($value == null)) { synchronized (this.field) { - value = this.field.get(); - if ((value == null)) + $value = this.field.get(); + if (($value == null)) { final E actualValue = getAny(); - value = ((actualValue == null) ? this.field : actualValue); - this.field.set(value); + $value = ((actualValue == null) ? this.field : actualValue); + this.field.set($value); } } } - return (E) ((value == this.field) ? null : value); + return (E) (($value == this.field) ? null : $value); } public @java.lang.SuppressWarnings({"all", "unchecked"}) long getField2() { - java.lang.Object value = this.field2.get(); - if ((value == null)) + java.lang.Object $value = this.field2.get(); + if (($value == null)) { synchronized (this.field2) { - value = this.field2.get(); - if ((value == null)) + $value = this.field2.get(); + if (($value == null)) { final long actualValue = System.currentTimeMillis(); - value = actualValue; - this.field2.set(value); + $value = actualValue; + this.field2.set($value); } } } - return (java.lang.Long) value; + return (java.lang.Long) $value; } } \ No newline at end of file diff --git a/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java b/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java index ab8bc5997c..dadd8e71ec 100644 --- a/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java +++ b/test/transform/resource/after-ecj/GetterLazyInAnonymousClass.java @@ -7,21 +7,21 @@ class Inner { super(); } public @java.lang.SuppressWarnings({"all", "unchecked"}) String getString() { - java.lang.Object value = this.string.get(); - if ((value == null)) + java.lang.Object $value = this.string.get(); + if (($value == null)) { synchronized (this.string) { - value = this.string.get(); - if ((value == null)) + $value = this.string.get(); + if (($value == null)) { final String actualValue = "test"; - value = ((actualValue == null) ? this.string : actualValue); - this.string.set(value); + $value = ((actualValue == null) ? this.string : actualValue); + this.string.set($value); } } } - return (String) ((value == this.string) ? null : value); + return (String) (($value == this.string) ? null : $value); } } x() { diff --git a/test/transform/resource/after-ecj/GetterLazyNative.java b/test/transform/resource/after-ecj/GetterLazyNative.java index 7808068e59..c2769c5123 100644 --- a/test/transform/resource/after-ecj/GetterLazyNative.java +++ b/test/transform/resource/after-ecj/GetterLazyNative.java @@ -12,156 +12,156 @@ class GetterLazyNative { super(); } public @java.lang.SuppressWarnings({"all", "unchecked"}) boolean isBooleanField() { - java.lang.Object value = this.booleanField.get(); - if ((value == null)) + java.lang.Object $value = this.booleanField.get(); + if (($value == null)) { synchronized (this.booleanField) { - value = this.booleanField.get(); - if ((value == null)) + $value = this.booleanField.get(); + if (($value == null)) { final boolean actualValue = true; - value = actualValue; - this.booleanField.set(value); + $value = actualValue; + this.booleanField.set($value); } } } - return (java.lang.Boolean) value; + return (java.lang.Boolean) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) byte getByteField() { - java.lang.Object value = this.byteField.get(); - if ((value == null)) + java.lang.Object $value = this.byteField.get(); + if (($value == null)) { synchronized (this.byteField) { - value = this.byteField.get(); - if ((value == null)) + $value = this.byteField.get(); + if (($value == null)) { final byte actualValue = 1; - value = actualValue; - this.byteField.set(value); + $value = actualValue; + this.byteField.set($value); } } } - return (java.lang.Byte) value; + return (java.lang.Byte) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) short getShortField() { - java.lang.Object value = this.shortField.get(); - if ((value == null)) + java.lang.Object $value = this.shortField.get(); + if (($value == null)) { synchronized (this.shortField) { - value = this.shortField.get(); - if ((value == null)) + $value = this.shortField.get(); + if (($value == null)) { final short actualValue = 1; - value = actualValue; - this.shortField.set(value); + $value = actualValue; + this.shortField.set($value); } } } - return (java.lang.Short) value; + return (java.lang.Short) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) int getIntField() { - java.lang.Object value = this.intField.get(); - if ((value == null)) + java.lang.Object $value = this.intField.get(); + if (($value == null)) { synchronized (this.intField) { - value = this.intField.get(); - if ((value == null)) + $value = this.intField.get(); + if (($value == null)) { final int actualValue = 1; - value = actualValue; - this.intField.set(value); + $value = actualValue; + this.intField.set($value); } } } - return (java.lang.Integer) value; + return (java.lang.Integer) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) long getLongField() { - java.lang.Object value = this.longField.get(); - if ((value == null)) + java.lang.Object $value = this.longField.get(); + if (($value == null)) { synchronized (this.longField) { - value = this.longField.get(); - if ((value == null)) + $value = this.longField.get(); + if (($value == null)) { final long actualValue = 1; - value = actualValue; - this.longField.set(value); + $value = actualValue; + this.longField.set($value); } } } - return (java.lang.Long) value; + return (java.lang.Long) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) float getFloatField() { - java.lang.Object value = this.floatField.get(); - if ((value == null)) + java.lang.Object $value = this.floatField.get(); + if (($value == null)) { synchronized (this.floatField) { - value = this.floatField.get(); - if ((value == null)) + $value = this.floatField.get(); + if (($value == null)) { final float actualValue = 1.0f; - value = actualValue; - this.floatField.set(value); + $value = actualValue; + this.floatField.set($value); } } } - return (java.lang.Float) value; + return (java.lang.Float) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) double getDoubleField() { - java.lang.Object value = this.doubleField.get(); - if ((value == null)) + java.lang.Object $value = this.doubleField.get(); + if (($value == null)) { synchronized (this.doubleField) { - value = this.doubleField.get(); - if ((value == null)) + $value = this.doubleField.get(); + if (($value == null)) { final double actualValue = 1.0; - value = actualValue; - this.doubleField.set(value); + $value = actualValue; + this.doubleField.set($value); } } } - return (java.lang.Double) value; + return (java.lang.Double) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) char getCharField() { - java.lang.Object value = this.charField.get(); - if ((value == null)) + java.lang.Object $value = this.charField.get(); + if (($value == null)) { synchronized (this.charField) { - value = this.charField.get(); - if ((value == null)) + $value = this.charField.get(); + if (($value == null)) { final char actualValue = '1'; - value = actualValue; - this.charField.set(value); + $value = actualValue; + this.charField.set($value); } } } - return (java.lang.Character) value; + return (java.lang.Character) $value; } public @java.lang.SuppressWarnings({"all", "unchecked"}) int[] getIntArrayField() { - java.lang.Object value = this.intArrayField.get(); - if ((value == null)) + java.lang.Object $value = this.intArrayField.get(); + if (($value == null)) { synchronized (this.intArrayField) { - value = this.intArrayField.get(); - if ((value == null)) + $value = this.intArrayField.get(); + if (($value == null)) { final int[] actualValue = new int[]{1}; - value = ((actualValue == null) ? this.intArrayField : actualValue); - this.intArrayField.set(value); + $value = ((actualValue == null) ? this.intArrayField : actualValue); + this.intArrayField.set($value); } } } - return (int[]) ((value == this.intArrayField) ? null : value); + return (int[]) (($value == this.intArrayField) ? null : $value); } } diff --git a/test/transform/resource/after-ecj/GetterLazyTransient.java b/test/transform/resource/after-ecj/GetterLazyTransient.java index 7e5f4a416f..b97fe53315 100644 --- a/test/transform/resource/after-ecj/GetterLazyTransient.java +++ b/test/transform/resource/after-ecj/GetterLazyTransient.java @@ -6,21 +6,21 @@ class GetterLazyTransient { super(); } public @java.lang.SuppressWarnings({"all", "unchecked"}) int getNonTransientField() { - java.lang.Object value = this.nonTransientField.get(); - if ((value == null)) + java.lang.Object $value = this.nonTransientField.get(); + if (($value == null)) { synchronized (this.nonTransientField) { - value = this.nonTransientField.get(); - if ((value == null)) + $value = this.nonTransientField.get(); + if (($value == null)) { final int actualValue = 1; - value = actualValue; - this.nonTransientField.set(value); + $value = actualValue; + this.nonTransientField.set($value); } } } - return (java.lang.Integer) value; + return (java.lang.Integer) $value; } public @java.lang.SuppressWarnings("all") int getNonLazyTransientField() { return this.nonLazyTransientField; diff --git a/test/transform/resource/after-ecj/SkipSuppressWarnings.java b/test/transform/resource/after-ecj/SkipSuppressWarnings.java index 5303251987..76b79fe2ad 100644 --- a/test/transform/resource/after-ecj/SkipSuppressWarnings.java +++ b/test/transform/resource/after-ecj/SkipSuppressWarnings.java @@ -8,20 +8,20 @@ public String getField() { return this.field; } public @java.lang.SuppressWarnings({"unchecked"}) String getField2() { - java.lang.Object value = this.field2.get(); - if ((value == null)) + java.lang.Object $value = this.field2.get(); + if (($value == null)) { synchronized (this.field2) { - value = this.field2.get(); - if ((value == null)) + $value = this.field2.get(); + if (($value == null)) { final String actualValue = ""; - value = ((actualValue == null) ? this.field2 : actualValue); - this.field2.set(value); + $value = ((actualValue == null) ? this.field2 : actualValue); + this.field2.set($value); } } } - return (String) ((value == this.field2) ? null : value); + return (String) (($value == this.field2) ? null : $value); } } \ No newline at end of file