Resolve ambiguity between descriptorFile and fileName when parsing descriptors
In 1.9.0 a new method getDescrptorFile
was introduced. This actually can cause various problems and has some open design questions that should be answered in this ticket.
(I'll attach a branch with a test demonstrating part of the problem.)
DescriptorParser
has the new method (since 1.9.0):
public Iterable<Descriptor> parseDescriptors(byte[] rawDescriptorBytes,
File descriptorFile, String fileName);
In addition to the problem demonstrated in the (to be attached) test this raises some questions:
- What should be done, if
descriptorFile.getName() != fileName
? - What should be done, if
descriptorFile != null && (null == fileName || fileName.isEmpty())
? - What should be done, if
descriptorFile == null && null != fileName
? 4a) What should be done, ifdescriptorFile == null && null != fileName && fileName.isEmpty()
? 4b) What should be done, ifdescriptorFile == null && null == fileName
?
The implementation of the solution should also have tests for each of the possible cases.