Disallow construction of DexPathList.Element with path == dexFile == null.

Before this CL, the constructor invocations:

 new Element(null, null)
 new Element(null, false, null, null)

would have resulted in an Element with path == dexFile == null.
Such an element would make no sense and would have thrown NPE
during toString().

This CL changes the constructor behavior to throw NPE at construction
time instead. For the legacy constructor, this error condition is
checked ahead of other unsupported invocations. The behavior change
should only affect invalid uses that we do not want to support.

The guarantee that at least one of { path, dexFile } is != null
allowed a slight simplification of the toString() implementation.

Test: CtsLibcoreTestCases

Change-Id: I3ff513f82cdc62ff39b59c60a84cf8b4b83b6ce4
1 file changed