You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/08/14 12:34:44 UTC

svn commit: r1804989 - in /myfaces/core/branches/2.3.x/api/src: main/java/javax/faces/component/ main/java/javax/faces/component/behavior/ test/java/javax/faces/component/

Author: tandraschko
Date: Mon Aug 14 12:34:44 2017
New Revision: 1804989

URL: http://svn.apache.org/viewvc?rev=1804989&view=rev
Log:
MYFACES-3435 [perf] _DeltaList / _ComponentChildrenList: use ArrayList as parent

Modified:
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponent.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponentBase.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIInput.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_ComponentChildrenList.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_DeltaList.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java
    myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/_DeltaList.java
    myfaces/core/branches/2.3.x/api/src/test/java/javax/faces/component/_DeltaListTest.java

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponent.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponent.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponent.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponent.java Mon Aug 14 12:34:44 2017
@@ -932,7 +932,7 @@ public abstract class UIComponent
         {
             // how many listeners per event type can single component have? 
             // We use 3 here as expected number, but it is a question 
-            listeners = new _DeltaList<SystemEventListener>(new ArrayList<SystemEventListener>(3));
+            listeners = new _DeltaList<SystemEventListener>(3);
             _systemEventListenerClassMap.put(eventClass, listeners);
         }
 

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponentBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponentBase.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponentBase.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIComponentBase.java Mon Aug 14 12:34:44 2017
@@ -375,7 +375,7 @@ public abstract class UIComponentBase ex
             {
                 // Normally have client only 1 client behaviour per event name,
                 // so size 2 must be sufficient: 
-                behaviorsForEvent = new _DeltaList<ClientBehavior>(new ArrayList<ClientBehavior>(2));
+                behaviorsForEvent = new _DeltaList<ClientBehavior>(2);
                 _behaviorsMap.put(eventName, behaviorsForEvent);
             }
             
@@ -1256,7 +1256,7 @@ public abstract class UIComponentBase ex
         if (_facesListeners == null)
         {
             // How many facesListeners have single component normally? 
-            _facesListeners = new _DeltaList<FacesListener>(new ArrayList<FacesListener>(5));
+            _facesListeners = new _DeltaList<FacesListener>(5);
         }
         _facesListeners.add(listener);
     }

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIInput.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIInput.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIInput.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/UIInput.java Mon Aug 14 12:34:44 2017
@@ -855,7 +855,7 @@ public class UIInput extends UIOutput im
         if (_validatorList == null)
         {
             //normally add user 0-3 validators: 
-            _validatorList = new _DeltaList<Validator>(new ArrayList<Validator>(3));
+            _validatorList = new _DeltaList<Validator>(3);
         }
 
         _validatorList.add(validator);

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_ComponentChildrenList.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_ComponentChildrenList.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_ComponentChildrenList.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_ComponentChildrenList.java Mon Aug 14 12:34:44 2017
@@ -19,34 +19,32 @@
 package javax.faces.component;
 
 import java.io.Serializable;
-import java.util.AbstractList;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
-import java.util.List;
 import java.util.Map;
-import java.util.RandomAccess;
 
-class _ComponentChildrenList extends AbstractList<UIComponent> implements Serializable, RandomAccess
+class _ComponentChildrenList extends ArrayList<UIComponent> implements Serializable
 {
     private static final long serialVersionUID = -6775078929331154224L;
     private UIComponent _component;
-    private List<UIComponent> _list = new ArrayList<UIComponent>(4);
 
     _ComponentChildrenList(UIComponent component)
     {
+        super(4);
         _component = component;
     }
 
     @Override
     public UIComponent get(int index)
     {
-        return _list.get(index);
+        return super.get(index);
     }
 
     @Override
     public int size()
     {
-        return _list.size();
+        return super.size();
     }
 
     @Override
@@ -54,7 +52,7 @@ class _ComponentChildrenList extends Abs
     {
         checkValue(value);
         removeChildrenFromParent(value);
-        UIComponent child = _list.set(index, value);
+        UIComponent child = super.set(index, value);
         if (child != value)
         {
             updateParent(value);
@@ -73,7 +71,7 @@ class _ComponentChildrenList extends Abs
         checkValue(value);
 
         removeChildrenFromParent(value);
-        boolean res = _list.add(value);
+        boolean res = super.add(value);
         
         updateParent(value);
         
@@ -87,7 +85,7 @@ class _ComponentChildrenList extends Abs
         
         removeChildrenFromParent(value);
         
-        _list.add(index, value);
+        super.add(index, value);
         
         updateParent(value);
     }
@@ -95,7 +93,7 @@ class _ComponentChildrenList extends Abs
     @Override
     public UIComponent remove(int index)
     {
-        UIComponent child = _list.remove(index);
+        UIComponent child = super.remove(index);
         if (child != null)
         {
             childRemoved(child);
@@ -110,12 +108,6 @@ class _ComponentChildrenList extends Abs
         {
             throw new NullPointerException("value");
         }
-        
-        // Not necessary anymore because  
-        //if (!(value instanceof UIComponent))
-        //{
-        //    throw new ClassCastException("value is not a UIComponent");
-        //}
     }
 
     private void childRemoved(UIComponent child)
@@ -164,11 +156,54 @@ class _ComponentChildrenList extends Abs
         
         checkValue(value);
 
-        if (_list.remove(value))
+        if (super.remove(value))
         {
             childRemoved((UIComponent)value);
             return true;
         }
         return false;
     }
-}
+
+    @Override
+    public void clear()
+    {
+        removeRange(0, size());
+    }
+
+    @Override
+    public boolean addAll(Collection<? extends UIComponent> collection)
+    {
+        boolean result = false;
+        Iterator<? extends UIComponent> it = collection.iterator();
+        while (it.hasNext())
+        {
+            if (add(it.next()))
+            {
+                result = true;
+            }
+        }
+        return result;
+    }
+
+    @Override
+    public boolean addAll(int location, Collection<? extends UIComponent> collection)
+    {
+        Iterator<? extends UIComponent> it = collection.iterator();
+        while (it.hasNext())
+        {
+            add(location++, it.next());
+        }
+        return !collection.isEmpty();
+    }
+
+    @Override
+    protected void removeRange(int start, int end)
+    {
+        Iterator<?> it = listIterator(start);
+        for (int i = start; i < end; i++)
+        {
+            it.next();
+            it.remove();
+        }
+    }
+}
\ No newline at end of file

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_DeltaList.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_DeltaList.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_DeltaList.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/_DeltaList.java Mon Aug 14 12:34:44 2017
@@ -40,155 +40,80 @@ import javax.faces.context.FacesContext;
  * A facesListener could hold PartialStateHolder instances, so it 
  * is necessary to provide convenient methods to track deltas.
  */
-class _DeltaList<T> implements List<T>, PartialStateHolder, RandomAccess
+class _DeltaList<T> extends ArrayList<T> implements List<T>, PartialStateHolder, RandomAccess
 {
     private static Object[] emptyObjectArray = new Object[]{};
 
-    private List<T> _delegate;
     private boolean _initialStateMarked;
     
     public _DeltaList()
     {
+        super();
     }
     
-    public _DeltaList(List<T> delegate)
+    public _DeltaList(int initialCapacity)
     {
-        _delegate = delegate;
+        super(initialCapacity);
     }
     
     public void add(int index, T element)
     {
         clearInitialState();
-        _delegate.add(index, element);
+        super.add(index, element);
     }
 
     public boolean add(T e)
     {
         clearInitialState();
-        return _delegate.add(e);
+        return super.add(e);
     }
 
     public boolean addAll(Collection<? extends T> c)
     {
         clearInitialState();
-        return _delegate.addAll(c);
+        return super.addAll(c);
     }
 
     public boolean addAll(int index, Collection<? extends T> c)
     {
         clearInitialState();
-        return _delegate.addAll(index, c);
+        return super.addAll(index, c);
     }
 
     public void clear()
     {
         clearInitialState();
-        _delegate.clear();
-    }
-
-    public boolean contains(Object o)
-    {
-        return _delegate.contains(o);
-    }
-
-    public boolean containsAll(Collection<?> c)
-    {
-        return _delegate.containsAll(c);
-    }
-
-    public boolean equals(Object o)
-    {
-        return _delegate.equals(o);
-    }
-
-    public T get(int index)
-    {
-        return _delegate.get(index);
-    }
-
-    public int hashCode()
-    {
-        return _delegate.hashCode();
-    }
-
-    public int indexOf(Object o)
-    {
-        return _delegate.indexOf(o);
-    }
-
-    public boolean isEmpty()
-    {
-        return _delegate.isEmpty();
-    }
-
-    public Iterator<T> iterator()
-    {
-        return _delegate.iterator();
-    }
-
-    public int lastIndexOf(Object o)
-    {
-        return _delegate.lastIndexOf(o);
-    }
-
-    public ListIterator<T> listIterator()
-    {
-        return _delegate.listIterator();
-    }
-
-    public ListIterator<T> listIterator(int index)
-    {
-        return _delegate.listIterator(index);
+        super.clear();
     }
 
     public T remove(int index)
     {
         clearInitialState();
-        return _delegate.remove(index);
+        return super.remove(index);
     }
 
     public boolean remove(Object o)
     {
         clearInitialState();
-        return _delegate.remove(o);
+        return super.remove(o);
     }
 
     public boolean removeAll(Collection<?> c)
     {
         clearInitialState();
-        return _delegate.removeAll(c);
+        return super.removeAll(c);
     }
 
     public boolean retainAll(Collection<?> c)
     {
         clearInitialState();
-        return _delegate.retainAll(c);
+        return super.retainAll(c);
     }
 
     public T set(int index, T element)
     {
         clearInitialState();
-        return _delegate.set(index, element);
-    }
-
-    public int size()
-    {
-        return _delegate == null ? 0 : _delegate.size();
-    }
-
-    public List<T> subList(int fromIndex, int toIndex)
-    {
-        return _delegate.subList(fromIndex, toIndex);
-    }
-
-    public Object[] toArray()
-    {
-        return _delegate.toArray();
-    }
-
-    public <T> T[] toArray(T[] a)
-    {
-        return _delegate.toArray(a);
+        return super.set(index, element);
     }
 
     public boolean isTransient()
@@ -219,19 +144,19 @@ class _DeltaList<T> implements List<T>,
                 if (lst[i] instanceof _AttachedDeltaWrapper)
                 {
                     //Delta
-                    ((StateHolder)_delegate.get(j)).restoreState(context,
+                    ((StateHolder)super.get(j)).restoreState(context,
                             ((_AttachedDeltaWrapper) lst[i]).getWrappedStateObject());
                     j++;
                 }
                 else if (lst[i] != null)
                 {
                     //Full
-                    _delegate.set(j, (T) UIComponentBase.restoreAttachedState(context, lst[i]));
+                    super.set(j, (T) UIComponentBase.restoreAttachedState(context, lst[i]));
                     j++;
                 }
                 else
                 {
-                    _delegate.remove(j);
+                    super.remove(j);
                 }
                 i++;
             }
@@ -246,13 +171,16 @@ class _DeltaList<T> implements List<T>,
         {
             //Restore delegate
             Object[] lst = (Object[]) state;
-            _delegate = new ArrayList<T>(lst.length);
+            
+            clear();
+            ensureCapacity(lst.length);
+
             for (int i = 0; i < lst.length; i++)
             {
                 T value = (T) UIComponentBase.restoreAttachedState(context, lst[i]);
                 if (value != null)
                 {
-                    _delegate.add(value);
+                    super.add(value);
                 }
             }
         }
@@ -260,7 +188,7 @@ class _DeltaList<T> implements List<T>,
 
     public Object saveState(FacesContext context)
     {
-        int size = _delegate.size();
+        int size = super.size();
         if (initialStateMarked())
         {
             Object [] lst = null;
@@ -270,7 +198,7 @@ class _DeltaList<T> implements List<T>,
                 lst = new Object[size];
                 for (int i = 0; i < size; i++)
                 {
-                    Object value = _delegate.get(i);
+                    Object value = super.get(i);
                     if (value instanceof PartialStateHolder)
                     {
                         //Delta
@@ -314,7 +242,7 @@ class _DeltaList<T> implements List<T>,
                 Object [] lst = new Object[size];
                 for (int i = 0; i < size; i++)
                 {
-                    lst[i] = UIComponentBase.saveAttachedState(context, _delegate.get(i));
+                    lst[i] = UIComponentBase.saveAttachedState(context, super.get(i));
                 }
                 return lst;
             }
@@ -331,14 +259,13 @@ class _DeltaList<T> implements List<T>,
         if (_initialStateMarked)
         {
             _initialStateMarked = false;
-            if (_delegate != null)
+
+            for (int i = 0; i < super.size(); i++)
             {
-                for (T value : _delegate)
+                T value = super.get(i);
+                if (value instanceof PartialStateHolder)
                 {
-                    if (value instanceof PartialStateHolder)
-                    {
-                        ((PartialStateHolder)value).clearInitialState();
-                    }
+                    ((PartialStateHolder)value).clearInitialState();
                 }
             }
         }
@@ -352,16 +279,14 @@ class _DeltaList<T> implements List<T>,
     public void markInitialState()
     {
         _initialStateMarked = true;
-        if (_delegate != null)
+
+        int size = super.size();
+        for (int i = 0; i < size; i++)
         {
-            int size = _delegate.size();
-            for (int i = 0; i < size; i++)
+            T value = super.get(i);
+            if (value instanceof PartialStateHolder)
             {
-                T value = _delegate.get(i);
-                if (value instanceof PartialStateHolder)
-                {
-                    ((PartialStateHolder)value).markInitialState();
-                }
+                ((PartialStateHolder)value).markInitialState();
             }
         }
     }

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/BehaviorBase.java Mon Aug 14 12:34:44 2017
@@ -265,7 +265,7 @@ public class BehaviorBase implements Beh
         {
             // Lazy instanciation with size 1:
             // the only posibility how to add listener is <f:ajax listener="" /> - there is no <f:ajaxListener/> tag 
-            _behaviorListeners = new _DeltaList<BehaviorListener>(new ArrayList<BehaviorListener>(1));
+            _behaviorListeners = new _DeltaList<BehaviorListener>(1);
         }
         
         _behaviorListeners.add(listener);

Modified: myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/_DeltaList.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/_DeltaList.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/_DeltaList.java (original)
+++ myfaces/core/branches/2.3.x/api/src/main/java/javax/faces/component/behavior/_DeltaList.java Mon Aug 14 12:34:44 2017
@@ -43,155 +43,80 @@ import javax.faces.context.FacesContext;
  * A facesListener could hold PartialStateHolder instances, so it 
  * is necessary to provide convenient methods to track deltas.
  */
-class _DeltaList<T> implements List<T>, PartialStateHolder, RandomAccess
+class _DeltaList<T> extends ArrayList<T> implements List<T>, PartialStateHolder, RandomAccess
 {
     private static Object[] emptyObjectArray = new Object[]{};
 
-    private List<T> _delegate;
     private boolean _initialStateMarked;
     
     public _DeltaList()
     {
+        super();
     }
     
-    public _DeltaList(List<T> delegate)
+    public _DeltaList(int initialCapacity)
     {
-        _delegate = delegate;
+        super(initialCapacity);
     }
     
     public void add(int index, T element)
     {
         clearInitialState();
-        _delegate.add(index, element);
+        super.add(index, element);
     }
 
     public boolean add(T e)
     {
         clearInitialState();
-        return _delegate.add(e);
+        return super.add(e);
     }
 
     public boolean addAll(Collection<? extends T> c)
     {
         clearInitialState();
-        return _delegate.addAll(c);
+        return super.addAll(c);
     }
 
     public boolean addAll(int index, Collection<? extends T> c)
     {
         clearInitialState();
-        return _delegate.addAll(index, c);
+        return super.addAll(index, c);
     }
 
     public void clear()
     {
         clearInitialState();
-        _delegate.clear();
-    }
-
-    public boolean contains(Object o)
-    {
-        return _delegate.contains(o);
-    }
-
-    public boolean containsAll(Collection<?> c)
-    {
-        return _delegate.containsAll(c);
-    }
-
-    public boolean equals(Object o)
-    {
-        return _delegate.equals(o);
-    }
-
-    public T get(int index)
-    {
-        return _delegate.get(index);
-    }
-
-    public int hashCode()
-    {
-        return _delegate.hashCode();
-    }
-
-    public int indexOf(Object o)
-    {
-        return _delegate.indexOf(o);
-    }
-
-    public boolean isEmpty()
-    {
-        return _delegate.isEmpty();
-    }
-
-    public Iterator<T> iterator()
-    {
-        return _delegate.iterator();
-    }
-
-    public int lastIndexOf(Object o)
-    {
-        return _delegate.lastIndexOf(o);
-    }
-
-    public ListIterator<T> listIterator()
-    {
-        return _delegate.listIterator();
-    }
-
-    public ListIterator<T> listIterator(int index)
-    {
-        return _delegate.listIterator(index);
+        super.clear();
     }
 
     public T remove(int index)
     {
         clearInitialState();
-        return _delegate.remove(index);
+        return super.remove(index);
     }
 
     public boolean remove(Object o)
     {
         clearInitialState();
-        return _delegate.remove(o);
+        return super.remove(o);
     }
 
     public boolean removeAll(Collection<?> c)
     {
         clearInitialState();
-        return _delegate.removeAll(c);
+        return super.removeAll(c);
     }
 
     public boolean retainAll(Collection<?> c)
     {
         clearInitialState();
-        return _delegate.retainAll(c);
+        return super.retainAll(c);
     }
 
     public T set(int index, T element)
     {
         clearInitialState();
-        return _delegate.set(index, element);
-    }
-
-    public int size()
-    {
-        return _delegate == null ? 0 : _delegate.size();
-    }
-
-    public List<T> subList(int fromIndex, int toIndex)
-    {
-        return _delegate.subList(fromIndex, toIndex);
-    }
-
-    public Object[] toArray()
-    {
-        return _delegate.toArray();
-    }
-
-    public <T> T[] toArray(T[] a)
-    {
-        return _delegate.toArray(a);
+        return super.set(index, element);
     }
 
     public boolean isTransient()
@@ -222,19 +147,19 @@ class _DeltaList<T> implements List<T>,
                 if (lst[i] instanceof _AttachedDeltaWrapper)
                 {
                     //Delta
-                    ((StateHolder)_delegate.get(j)).restoreState(context,
+                    ((StateHolder)super.get(j)).restoreState(context,
                             ((_AttachedDeltaWrapper) lst[i]).getWrappedStateObject());
                     j++;
                 }
                 else if (lst[i] != null)
                 {
                     //Full
-                    _delegate.set(j, (T) UIComponentBase.restoreAttachedState(context, lst[i]));
+                    super.set(j, (T) UIComponentBase.restoreAttachedState(context, lst[i]));
                     j++;
                 }
                 else
                 {
-                    _delegate.remove(j);
+                    super.remove(j);
                 }
                 i++;
             }
@@ -249,13 +174,16 @@ class _DeltaList<T> implements List<T>,
         {
             //Restore delegate
             Object[] lst = (Object[]) state;
-            _delegate = new ArrayList<T>(lst.length);
+            
+            clear();
+            ensureCapacity(lst.length);
+            
             for (int i = 0; i < lst.length; i++)
             {
                 T value = (T) UIComponentBase.restoreAttachedState(context, lst[i]);
                 if (value != null)
                 {
-                    _delegate.add(value);
+                    super.add(value);
                 }
             }
         }
@@ -263,7 +191,7 @@ class _DeltaList<T> implements List<T>,
 
     public Object saveState(FacesContext context)
     {
-        int size = _delegate.size();
+        int size = super.size();
         if (initialStateMarked())
         {
             Object [] lst = null;
@@ -273,7 +201,7 @@ class _DeltaList<T> implements List<T>,
                 lst = new Object[size];
                 for (int i = 0; i < size; i++)
                 {
-                    Object value = _delegate.get(i);
+                    Object value = super.get(i);
                     if (value instanceof PartialStateHolder)
                     {
                         //Delta
@@ -317,7 +245,7 @@ class _DeltaList<T> implements List<T>,
                 Object [] lst = new Object[size];
                 for (int i = 0; i < size; i++)
                 {
-                    lst[i] = UIComponentBase.saveAttachedState(context, _delegate.get(i));
+                    lst[i] = UIComponentBase.saveAttachedState(context, super.get(i));
                 }
                 return lst;
             }
@@ -334,14 +262,13 @@ class _DeltaList<T> implements List<T>,
         if (_initialStateMarked)
         {
             _initialStateMarked = false;
-            if (_delegate != null)
+
+            for (int i = 0; i < super.size(); i++)
             {
-                for (T value : _delegate)
+                T value = super.get(i);
+                if (value instanceof PartialStateHolder)
                 {
-                    if (value instanceof PartialStateHolder)
-                    {
-                        ((PartialStateHolder)value).clearInitialState();
-                    }
+                    ((PartialStateHolder)value).clearInitialState();
                 }
             }
         }
@@ -355,16 +282,14 @@ class _DeltaList<T> implements List<T>,
     public void markInitialState()
     {
         _initialStateMarked = true;
-        if (_delegate != null)
+
+        int size = super.size();
+        for (int i = 0; i < size; i++)
         {
-            int size = _delegate.size();
-            for (int i = 0; i < size; i++)
+            T value = super.get(i);
+            if (value instanceof PartialStateHolder)
             {
-                T value = _delegate.get(i);
-                if (value instanceof PartialStateHolder)
-                {
-                    ((PartialStateHolder)value).markInitialState();
-                }
+                ((PartialStateHolder)value).markInitialState();
             }
         }
     }

Modified: myfaces/core/branches/2.3.x/api/src/test/java/javax/faces/component/_DeltaListTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/api/src/test/java/javax/faces/component/_DeltaListTest.java?rev=1804989&r1=1804988&r2=1804989&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/api/src/test/java/javax/faces/component/_DeltaListTest.java (original)
+++ myfaces/core/branches/2.3.x/api/src/test/java/javax/faces/component/_DeltaListTest.java Mon Aug 14 12:34:44 2017
@@ -55,7 +55,7 @@ public class _DeltaListTest extends Abst
             }
             if (_facesListeners == null)
             {
-                _facesListeners = new _DeltaList<FacesListener>(new ArrayList<FacesListener>());
+                _facesListeners = new _DeltaList<FacesListener>();
             }
             _facesListeners.add(listener);
         }