cid#1326918 FB.NP_CLONE_COULD_RETURN_NULL
Change-Id: I875cc2fc868fb4f1f45e90320e1fdaf70fe871d8
This commit is contained in:
@@ -121,6 +121,11 @@ public class InterfaceContainer implements Cloneable
|
|||||||
this.elementData = new Object[initialCapacity];
|
this.elementData = new Object[initialCapacity];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private InterfaceContainer(Object[] data) {
|
||||||
|
elementData = data;
|
||||||
|
size = elementData == null ? 0 : elementData.length;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Trims the capacity of this <tt>ArrayList</tt> instance to be the
|
* Trims the capacity of this <tt>ArrayList</tt> instance to be the
|
||||||
* list's current size. An application can use this operation to minimize
|
* list's current size. An application can use this operation to minimize
|
||||||
@@ -448,16 +453,14 @@ public class InterfaceContainer implements Cloneable
|
|||||||
@Override
|
@Override
|
||||||
synchronized public Object clone()
|
synchronized public Object clone()
|
||||||
{
|
{
|
||||||
Object ret= null;
|
Object[] data;
|
||||||
if (elementData != null)
|
if (elementData == null) {
|
||||||
{
|
data = null;
|
||||||
InterfaceContainer cont= new InterfaceContainer();
|
} else {
|
||||||
cont.elementData = new Object[size];
|
data = new Object[size];
|
||||||
cont.size= size;
|
System.arraycopy(elementData, 0, data, 0, size);
|
||||||
System.arraycopy(elementData, 0, cont.elementData, 0, size);
|
|
||||||
ret= cont;
|
|
||||||
}
|
}
|
||||||
return ret;
|
return new InterfaceContainer(data);
|
||||||
}
|
}
|
||||||
synchronized public ListIterator listIterator()
|
synchronized public ListIterator listIterator()
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user