aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReinier Zwitserloot <reinier@zwitserloot.com>2013-07-07 09:14:59 +0200
committerReinier Zwitserloot <reinier@zwitserloot.com>2013-07-07 21:49:47 +0200
commitb6a23a7d94ee4f01b38a0e6d7db120fb05be0d6c (patch)
treed069c2bb8fbf828cdba0be7e689c7a032d3d5ded
parentdfc682a0010ff1ba77496dd7644a6dcbe93017e5 (diff)
downloadlombok-b6a23a7d94ee4f01b38a0e6d7db120fb05be0d6c.tar.gz
lombok-b6a23a7d94ee4f01b38a0e6d7db120fb05be0d6c.tar.bz2
lombok-b6a23a7d94ee4f01b38a0e6d7db120fb05be0d6c.zip
@Getter(lazy=true) now uses a different, more efficient desugaring. Implementing in javac, ecj still has to be done.
-rw-r--r--src/core/lombok/javac/handlers/HandleGetter.java72
-rw-r--r--test/transform/resource/after-delombok/DelegateOnGetter.java8
-rw-r--r--test/transform/resource/after-delombok/GetterLazy.java8
-rw-r--r--test/transform/resource/after-delombok/GetterLazyBoolean.java16
-rw-r--r--test/transform/resource/after-delombok/GetterLazyEahcToString.java8
-rw-r--r--test/transform/resource/after-delombok/GetterLazyNative.java74
-rw-r--r--test/transform/resource/messages-ecj/ValueExperimental.java.messages1
7 files changed, 109 insertions, 78 deletions
diff --git a/src/core/lombok/javac/handlers/HandleGetter.java b/src/core/lombok/javac/handlers/HandleGetter.java
index bc68d5ad..0385a235 100644
--- a/src/core/lombok/javac/handlers/HandleGetter.java
+++ b/src/core/lombok/javac/handlers/HandleGetter.java
@@ -52,11 +52,9 @@ import com.sun.tools.javac.tree.JCTree.JCExpressionStatement;
import com.sun.tools.javac.tree.JCTree.JCIf;
import com.sun.tools.javac.tree.JCTree.JCMethodDecl;
import com.sun.tools.javac.tree.JCTree.JCMethodInvocation;
-import com.sun.tools.javac.tree.JCTree.JCNewClass;
import com.sun.tools.javac.tree.JCTree.JCPrimitiveTypeTree;
import com.sun.tools.javac.tree.JCTree.JCStatement;
import com.sun.tools.javac.tree.JCTree.JCSynchronized;
-import com.sun.tools.javac.tree.JCTree.JCTypeApply;
import com.sun.tools.javac.tree.JCTree.JCTypeParameter;
import com.sun.tools.javac.tree.JCTree.JCVariableDecl;
import com.sun.tools.javac.tree.TreeMaker;
@@ -286,6 +284,7 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
}
private static final String AR = "java.util.concurrent.atomic.AtomicReference";
+ private static final String JLO = "java.lang.Object";
private static final List<JCExpression> NIL_EXPRESSION = List.nil();
private static final java.util.Map<Integer, String> TYPE_MAP;
@@ -304,37 +303,50 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
private List<JCStatement> createLazyGetterBody(TreeMaker maker, JavacNode fieldNode, JCTree source) {
/*
- java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get();
+ java.lang.Object value = this.fieldName.get();
if (value == null) {
synchronized (this.fieldName) {
value = this.fieldName.get();
- if (value == null) {
- final ValueType actualValue = new ValueType();
- value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue);
+ if (value == null) {
+ RawValueType actualValue = INITIALIZER_EXPRESSION;
+ [IF PRIMITIVE]
+ value = actualValue;
+ [ELSE]
+ value = actualValue == null ? this.fieldName : actualValue;
+ [END IF]
this.fieldName.set(value);
}
}
}
- return value.get();
+ [IF PRIMITIVE]
+ return (BoxedValueType) value;
+ [ELSE]
+ return (BoxedValueType) (value == this.fieldName ? null : value);
+ [END IF]
*/
ListBuffer<JCStatement> statements = ListBuffer.lb();
JCVariableDecl field = (JCVariableDecl) fieldNode.get();
JCExpression copyOfRawFieldType = copyType(maker, field);
+ JCExpression copyOfBoxedFieldType = null;
field.type = null;
+ boolean isPrimitive = false;
if (field.vartype instanceof JCPrimitiveTypeTree) {
String boxed = TYPE_MAP.get(((JCPrimitiveTypeTree)field.vartype).typetag);
if (boxed != null) {
+ isPrimitive = true;
field.vartype = chainDotsString(fieldNode, boxed);
+ copyOfBoxedFieldType = chainDotsString(fieldNode, boxed);
}
}
+ if (copyOfBoxedFieldType == null) copyOfBoxedFieldType = copyType(maker, field);
Name valueName = fieldNode.toName("value");
Name actualValueName = fieldNode.toName("actualValue");
- /* java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get();*/ {
- JCTypeApply valueVarType = maker.TypeApply(chainDotsString(fieldNode, AR), List.of(copyType(maker, field)));
+ /* java.lang.Object value = this.fieldName.get();*/ {
+ JCExpression valueVarType = chainDotsString(fieldNode, JLO);
statements.append(maker.VarDef(maker.Modifiers(0), valueName, valueVarType, callGet(fieldNode, createFieldAccessor(maker, fieldNode, FieldAccess.ALWAYS_FIELD))));
}
@@ -349,15 +361,23 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
/* if (value == null) { */ {
ListBuffer<JCStatement> innerIfStatements = ListBuffer.lb();
- /* ValueType actualValue = new ValueType(); */ {
+ /* RawValueType actualValue = INITIALIZER_EXPRESSION; */ {
innerIfStatements.append(maker.VarDef(maker.Modifiers(Flags.FINAL), actualValueName, copyOfRawFieldType, field.init));
}
- /* value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue);*/ {
- JCTypeApply valueVarType = maker.TypeApply(chainDotsString(fieldNode, AR), List.of(copyType(maker, field)));
- JCNewClass newInstance = maker.NewClass(null, NIL_EXPRESSION, valueVarType, List.<JCExpression>of(maker.Ident(actualValueName)), null);
-
- JCStatement statement = maker.Exec(maker.Assign(maker.Ident(valueName), newInstance));
- innerIfStatements.append(statement);
+ /* [IF primitive] value = actualValue; */ {
+ if (isPrimitive) {
+ JCStatement statement = maker.Exec(maker.Assign(maker.Ident(valueName), maker.Ident(actualValueName)));
+ innerIfStatements.append(statement);
+ }
+ }
+ /* [ELSE] value = actualValue == null ? this.fieldName : actualValue; */ {
+ if (!isPrimitive) {
+ JCExpression actualValueIsNull = maker.Binary(CTC_EQUAL, maker.Ident(actualValueName), maker.Literal(CTC_BOT, null));
+ JCExpression thisDotFieldName = createFieldAccessor(maker, fieldNode, FieldAccess.ALWAYS_FIELD);
+ JCExpression ternary = maker.Conditional(actualValueIsNull, thisDotFieldName, maker.Ident(actualValueName));
+ JCStatement statement = maker.Exec(maker.Assign(maker.Ident(valueName), ternary));
+ innerIfStatements.append(statement);
+ }
}
/* this.fieldName.set(value); */ {
JCStatement statement = callSet(fieldNode, createFieldAccessor(maker, fieldNode, FieldAccess.ALWAYS_FIELD), maker.Ident(valueName));
@@ -376,15 +396,25 @@ public class HandleGetter extends JavacAnnotationHandler<Getter> {
JCIf ifStatement = maker.If(isNull, maker.Block(0, List.<JCStatement>of(synchronizedStatement)), null);
statements.append(ifStatement);
}
- /* return value.get(); */
- statements.append(maker.Return(callGet(fieldNode, maker.Ident(valueName))));
+ /* [IF PRIMITIVE] return (BoxedValueType) value; */ {
+ if (isPrimitive) {
+ statements.append(maker.Return(maker.TypeCast(copyOfBoxedFieldType, maker.Ident(valueName))));
+ }
+ }
+ /* [ELSE] return (BoxedValueType) (value == this.fieldName ? null : value); */ {
+ if (!isPrimitive) {
+ JCExpression valueEqualsSelf = maker.Binary(CTC_EQUAL, maker.Ident(valueName), createFieldAccessor(maker, fieldNode, FieldAccess.ALWAYS_FIELD));
+ JCExpression ternary = maker.Conditional(valueEqualsSelf, maker.Literal(CTC_BOT, null), maker.Ident(valueName));
+ JCExpression typeCast = maker.TypeCast(copyOfBoxedFieldType, maker.Parens(ternary));
+ statements.append(maker.Return(typeCast));
+ }
+ }
// update the field type and init last
- /* private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>(); */ {
+ /* private final java.util.concurrent.atomic.AtomicReference<Object> fieldName = new java.util.concurrent.atomic.AtomicReference<Object>(); */ {
field.vartype = recursiveSetGeneratedBy(
- maker.TypeApply(chainDotsString(fieldNode, AR), List.<JCExpression>of(maker.TypeApply(chainDotsString(fieldNode, AR), List.of(copyType(maker, field))))),
- source);
+ maker.TypeApply(chainDotsString(fieldNode, AR), List.<JCExpression>of(chainDotsString(fieldNode, JLO))), source);
field.init = recursiveSetGeneratedBy(maker.NewClass(null, NIL_EXPRESSION, copyType(maker, field), NIL_EXPRESSION, null), source);
}
diff --git a/test/transform/resource/after-delombok/DelegateOnGetter.java b/test/transform/resource/after-delombok/DelegateOnGetter.java
index 08d682a2..e8d01a49 100644
--- a/test/transform/resource/after-delombok/DelegateOnGetter.java
+++ b/test/transform/resource/after-delombok/DelegateOnGetter.java
@@ -1,12 +1,12 @@
class DelegateOnGetter {
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>> bar = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<Bar>>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> bar = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
private interface Bar {
void setList(java.util.ArrayList<java.lang.String> list);
int getInt();
}
@java.lang.SuppressWarnings("all")
public Bar getBar() {
- java.util.concurrent.atomic.AtomicReference<Bar> value = this.bar.get();
+ java.lang.Object value = this.bar.get();
if (value == null) {
synchronized (this.bar) {
value = this.bar.get();
@@ -18,12 +18,12 @@ class DelegateOnGetter {
return 42;
}
};
- value = new java.util.concurrent.atomic.AtomicReference<Bar>(actualValue);
+ value = actualValue == null ? this.bar : actualValue;
this.bar.set(value);
}
}
}
- return value.get();
+ return (Bar)(value == this.bar ? null : value);
}
@java.lang.SuppressWarnings("all")
public void setList(final java.util.ArrayList<java.lang.String> list) {
diff --git a/test/transform/resource/after-delombok/GetterLazy.java b/test/transform/resource/after-delombok/GetterLazy.java
index 95be39e3..4f6f2c03 100644
--- a/test/transform/resource/after-delombok/GetterLazy.java
+++ b/test/transform/resource/after-delombok/GetterLazy.java
@@ -1,20 +1,20 @@
class GetterLazy {
static class ValueType {
}
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>> fieldName = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<ValueType>>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> fieldName = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
@java.lang.SuppressWarnings("all")
public ValueType getFieldName() {
- java.util.concurrent.atomic.AtomicReference<ValueType> value = this.fieldName.get();
+ java.lang.Object value = this.fieldName.get();
if (value == null) {
synchronized (this.fieldName) {
value = this.fieldName.get();
if (value == null) {
final ValueType actualValue = new ValueType();
- value = new java.util.concurrent.atomic.AtomicReference<ValueType>(actualValue);
+ value = actualValue == null ? this.fieldName : actualValue;
this.fieldName.set(value);
}
}
}
- return value.get();
+ return (ValueType)(value == this.fieldName ? null : value);
}
}
diff --git a/test/transform/resource/after-delombok/GetterLazyBoolean.java b/test/transform/resource/after-delombok/GetterLazyBoolean.java
index caab2803..08d32013 100644
--- a/test/transform/resource/after-delombok/GetterLazyBoolean.java
+++ b/test/transform/resource/after-delombok/GetterLazyBoolean.java
@@ -1,6 +1,6 @@
class GetterLazyBoolean {
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> otherBooleanValue = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> booleanValue = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> otherBooleanValue = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
private static boolean calculateBoolean() {
return true;
}
@@ -33,32 +33,32 @@ class GetterLazyBoolean {
}
@java.lang.SuppressWarnings("all")
public boolean isBooleanValue() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanValue.get();
+ java.lang.Object value = this.booleanValue.get();
if (value == null) {
synchronized (this.booleanValue) {
value = this.booleanValue.get();
if (value == null) {
final boolean actualValue = calculateBoolean();
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue);
+ value = actualValue;
this.booleanValue.set(value);
}
}
}
- return value.get();
+ return (java.lang.Boolean)value;
}
@java.lang.SuppressWarnings("all")
public boolean isOtherBooleanValue() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.otherBooleanValue.get();
+ java.lang.Object value = this.otherBooleanValue.get();
if (value == null) {
synchronized (this.otherBooleanValue) {
value = this.otherBooleanValue.get();
if (value == null) {
final boolean actualValue = !calculateBoolean();
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue);
+ value = actualValue;
this.otherBooleanValue.set(value);
}
}
}
- return value.get();
+ return (java.lang.Boolean)value;
}
}
diff --git a/test/transform/resource/after-delombok/GetterLazyEahcToString.java b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
index ce3555fe..1358e536 100644
--- a/test/transform/resource/after-delombok/GetterLazyEahcToString.java
+++ b/test/transform/resource/after-delombok/GetterLazyEahcToString.java
@@ -1,6 +1,6 @@
class GetterLazyEahcToString {
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>> value = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<String>>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> value = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
private final String value2 = "";
@java.lang.Override
@@ -44,18 +44,18 @@ class GetterLazyEahcToString {
@java.lang.SuppressWarnings("all")
public String getValue() {
- java.util.concurrent.atomic.AtomicReference<String> value = this.value.get();
+ java.lang.Object value = this.value.get();
if (value == null) {
synchronized (this.value) {
value = this.value.get();
if (value == null) {
final String actualValue = "";
- value = new java.util.concurrent.atomic.AtomicReference<String>(actualValue);
+ value = actualValue == null ? this.value : actualValue;
this.value.set(value);
}
}
}
- return value.get();
+ return (String)(value == this.value ? null : value);
}
@java.lang.SuppressWarnings("all")
diff --git a/test/transform/resource/after-delombok/GetterLazyNative.java b/test/transform/resource/after-delombok/GetterLazyNative.java
index a10075ba..eb31991a 100644
--- a/test/transform/resource/after-delombok/GetterLazyNative.java
+++ b/test/transform/resource/after-delombok/GetterLazyNative.java
@@ -1,146 +1,146 @@
class GetterLazyNative {
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>> booleanField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>> byteField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Byte>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>> shortField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Short>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>> intField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Integer>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>> longField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Long>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>> floatField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Float>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>> doubleField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Double>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>> charField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<java.lang.Character>>();
- private final java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.util.concurrent.atomic.AtomicReference<int[]>>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> booleanField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> byteField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> shortField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> intField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> longField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> floatField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> doubleField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> charField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
+ private final java.util.concurrent.atomic.AtomicReference<java.lang.Object> intArrayField = new java.util.concurrent.atomic.AtomicReference<java.lang.Object>();
@java.lang.SuppressWarnings("all")
public boolean isBooleanField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Boolean> value = this.booleanField.get();
+ java.lang.Object value = this.booleanField.get();
if (value == null) {
synchronized (this.booleanField) {
value = this.booleanField.get();
if (value == null) {
final boolean actualValue = true;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Boolean>(actualValue);
+ value = actualValue;
this.booleanField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Boolean)value;
}
@java.lang.SuppressWarnings("all")
public byte getByteField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Byte> value = this.byteField.get();
+ java.lang.Object value = this.byteField.get();
if (value == null) {
synchronized (this.byteField) {
value = this.byteField.get();
if (value == null) {
final byte actualValue = 1;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Byte>(actualValue);
+ value = actualValue;
this.byteField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Byte)value;
}
@java.lang.SuppressWarnings("all")
public short getShortField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Short> value = this.shortField.get();
+ java.lang.Object value = this.shortField.get();
if (value == null) {
synchronized (this.shortField) {
value = this.shortField.get();
if (value == null) {
final short actualValue = 1;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Short>(actualValue);
+ value = actualValue;
this.shortField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Short)value;
}
@java.lang.SuppressWarnings("all")
public int getIntField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Integer> value = this.intField.get();
+ java.lang.Object value = this.intField.get();
if (value == null) {
synchronized (this.intField) {
value = this.intField.get();
if (value == null) {
final int actualValue = 1;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Integer>(actualValue);
+ value = actualValue;
this.intField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Integer)value;
}
@java.lang.SuppressWarnings("all")
public long getLongField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Long> value = this.longField.get();
+ java.lang.Object value = this.longField.get();
if (value == null) {
synchronized (this.longField) {
value = this.longField.get();
if (value == null) {
final long actualValue = 1;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Long>(actualValue);
+ value = actualValue;
this.longField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Long)value;
}
@java.lang.SuppressWarnings("all")
public float getFloatField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Float> value = this.floatField.get();
+ java.lang.Object value = this.floatField.get();
if (value == null) {
synchronized (this.floatField) {
value = this.floatField.get();
if (value == null) {
final float actualValue = 1.0F;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Float>(actualValue);
+ value = actualValue;
this.floatField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Float)value;
}
@java.lang.SuppressWarnings("all")
public double getDoubleField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Double> value = this.doubleField.get();
+ java.lang.Object value = this.doubleField.get();
if (value == null) {
synchronized (this.doubleField) {
value = this.doubleField.get();
if (value == null) {
final double actualValue = 1.0;
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Double>(actualValue);
+ value = actualValue;
this.doubleField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Double)value;
}
@java.lang.SuppressWarnings("all")
public char getCharField() {
- java.util.concurrent.atomic.AtomicReference<java.lang.Character> value = this.charField.get();
+ java.lang.Object value = this.charField.get();
if (value == null) {
synchronized (this.charField) {
value = this.charField.get();
if (value == null) {
final char actualValue = '1';
- value = new java.util.concurrent.atomic.AtomicReference<java.lang.Character>(actualValue);
+ value = actualValue;
this.charField.set(value);
}
}
}
- return value.get();
+ return (java.lang.Character)value;
}
@java.lang.SuppressWarnings("all")
public int[] getIntArrayField() {
- java.util.concurrent.atomic.AtomicReference<int[]> value = this.intArrayField.get();
+ java.lang.Object value = this.intArrayField.get();
if (value == null) {
synchronized (this.intArrayField) {
value = this.intArrayField.get();
if (value == null) {
final int[] actualValue = new int[]{1};
- value = new java.util.concurrent.atomic.AtomicReference<int[]>(actualValue);
+ value = actualValue == null ? this.intArrayField : actualValue;
this.intArrayField.set(value);
}
}
}
- return value.get();
+ return (int[])(value == this.intArrayField ? null : value);
}
-} \ No newline at end of file
+}
diff --git a/test/transform/resource/messages-ecj/ValueExperimental.java.messages b/test/transform/resource/messages-ecj/ValueExperimental.java.messages
new file mode 100644
index 00000000..db4520ca
--- /dev/null
+++ b/test/transform/resource/messages-ecj/ValueExperimental.java.messages
@@ -0,0 +1 @@
+1:7 The type Value is deprecated \ No newline at end of file