Le 24/06/2011 20:16, Adam Heath a écrit :
On 03/04/2011 05:29 PM, [email protected] wrote:
Author: mrisaliti
Date: Fri Mar 4 23:29:42 2011
New Revision: 1078215
URL: http://svn.apache.org/viewvc?rev=1078215&view=rev
Log:
Remove some warning in TTLObject (OFBIZ-4102)
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java
Modified:
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java?rev=1078215&r1=1078214&r2=1078215&view=diff
==============================================================================
---
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java
(original)
+++
ofbiz/trunk/framework/base/src/org/ofbiz/base/concurrent/TTLObject.java Fri
Mar 4 23:29:42 2011
@@ -29,6 +29,7 @@ import java.util.concurrent.atomic.Atomi
import org.ofbiz.base.lang.ObjectWrapper;
import org.ofbiz.base.lang.SourceMonitored;
+import org.ofbiz.base.util.UtilGenerics;
@SourceMonitored
public abstract class TTLObject<T> implements ObjectWrapper<T> {
@@ -81,9 +82,9 @@ public abstract class TTLObject<T> imple
}
public enum State { INVALID, REGEN, REGENERATING, GENERATE,
GENERATING, GENERATING_INITIAL, VALID, ERROR, ERROR_INITIAL, SET }
- private volatile ValueAndState<T> object = new
StandardValueAndState<T>(this, null, null, State.INVALID, 0, null, null);
- private static final AtomicReferenceFieldUpdater<TTLObject,
ValueAndState> objectAccessor =
AtomicReferenceFieldUpdater.newUpdater(TTLObject.class,
ValueAndState.class, "object");
- private static final AtomicIntegerFieldUpdater<TTLObject>
serialAccessor = AtomicIntegerFieldUpdater.newUpdater(TTLObject.class,
"serial");
+ @SuppressWarnings("unchecked")
+ private static final AtomicReferenceFieldUpdater<TTLObject<?>,
ValueAndState> objectAccessor =
UtilGenerics.cast(AtomicReferenceFieldUpdater.newUpdater(TTLObject.class,
ValueAndState.class, "object"));
+ private static final AtomicIntegerFieldUpdater<TTLObject<?>>
serialAccessor =
UtilGenerics.cast(AtomicIntegerFieldUpdater.newUpdater(TTLObject.class,
"serial"));
protected volatile int serial;
<rant>
NONONONONO. You removed the 'object' variable, which is accessed *only*
thru the updater.
PLEASE UNDERSTAND WHAT YOU ARE DOING.
</rant>
When you see a @SourceMonitored tag, that means that there are test
cases for the class(at the least). Try to find said test cases, and run
them.
In this case, run 'ant tests' in framework/base, and you'll see that
there is a class initialization error, due to this change.
what do you think of :
ofbiz]$ svn di build.xml
Index: build.xml
===================================================================
--- build.xml (révision 1139499)
+++ build.xml (copie de travail)
@@ -682,6 +682,7 @@
</target>
<target name="run-tests" depends="build"
description="Run OFBiz default tests, execute ant
run-install before and see results in
runtime/logs/test-results/html/all-tests.html.">
+ <antcall target="tests"/>
<java jar="ofbiz.jar" fork="true" resultproperty="test.result">
<jvmarg value="${memory.initial.param}"/>
<jvmarg value="${memory.max.param}"/>
--
Erwan de FERRIERES
www.nereide.biz