The different tests have separate methods for clarity when tests fail.
This is more important than the additional overhead of repeated
iteration over the test-descriptors, which are kept small.
This patch makes the following changes:
- Remove now unused import in DescriptorParser.
- Rename methods in DescriptorParserImpl to please checkstyle.
- Tweak a few things in DescriptorReaderImplTest, including accepting
varargs for dirs and putting back expected excluded files.
- Remove tests that were previously testing deprecated methods which
are now gone.
- Change the two tests ending in NoDescriptors() back so that they
really don't read any descriptors.
- Put back tests for unrecognized lines, but don't expect
DescriptorParseExceptions anymore and instead check
getUnrecognizedLines().
This patch makes the following changes:
- Remove (non-deprecated) method
DescriptorParser#parseDescriptors(byte[], String) which we clearly
forgot to deprecate earlier and which we shouldn't support in the
future. It returns a List (rather than Iterable) and throws
DescriptorParseException rather than include UnparseableDescriptor
in the result. Might deserve an extra notice in the change log.
- Put back a few lines `this.unrecognizedLines.add(line);` which got
lost in previous commits.
- Remove `failUnrecognizedDescriptorLines` parameters everywhere.
- Remove more obsolete code from DescriptorReaderImpl.
- Remove now obsolete attribute oldExitListEntries from ExitListImpl.
When we switched from storing copies of byte[] to storing byte[]
references, offset, and length, getRawDescriptor() suddenly became
more expensive than before. (Before that, copying bytes in the first
place was always expensive.) If an application only calls
Descriptor#getRawDescriptorBytes() to learn the array length, there's
now a more efficient way to provide that information.
This change simplifies the DescriptorReader interface and allows for
shorter and more concise application code. The result is that
DescriptorReader returns Descriptor instances rather than
DescriptorFile instances containing Descriptors and accepts a maximum
queue size in Descriptors, DescriptorFile is deprecated, and
Descriptor contains a File reference to the descriptor file.
Implements #22141.
Related to this change, this commit introduces a new
UnparseableDescriptor to be returned by DescriptorParser and
DescriptorReader if a descriptor cannot be parsed, as opposed to
throwing a DescriptorParseException or skipping the entire descriptor
file (fixes#22139), respectively.
Also related to this change, DescriptorParser now returns an Iterable
instead of a List, which prepares parsing large descriptor files
descriptor by descriptor (will be tackled in #20395).