Open Marcono1234 opened 4 years ago
@slachiewicz, it looks like this specific code was not changed. So is this not considered an issue, and path
should only contain the directories to be checked, but not individual files? (as mentioned in https://github.com/xvik/gradle-animalsniffer-plugin/issues/25)
Or did you close this issue by accident?
Ok, by mistake only - cleanup. Pr welcome
CheckSignatureTask.process()
does not sort the path elements, it just processes them in the order they are returned byPath.list()
: https://github.com/mojohaus/animal-sniffer/blob/364fc20773cfdde514a212a683c344d3a253bb8b/animal-sniffer-ant-tasks/src/main/java/org/codehaus/mojo/animal_sniffer/ant/CheckSignatureTask.java#L215-L219This causes issues when the list first contains the file name of a nested class and afterwards the file name of the enclosing class. In that case forbidden API usage could be detected for the nested class despite the enclosing class being annotated. Other methods first sort the file names to make sure enclosing classes are processed first (e.g. here).
Is that intended? I am not quite sure how
org.apache.tools.ant.types.Path
is supposed to be used. Is it legit to directly store class file names in it, or is it only intended to be a collection of directory paths?