Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CheckSignatureTask.process() does not sort file names #130

Open
Marcono1234 opened this issue Nov 4, 2020 · 2 comments
Open

CheckSignatureTask.process() does not sort file names #130

Marcono1234 opened this issue Nov 4, 2020 · 2 comments

Comments

@Marcono1234
Copy link
Contributor

CheckSignatureTask.process() does not sort the path elements, it just processes them in the order they are returned by Path.list():

final String[] files = path.list();
for ( int j = 0; j < files.length; j++ )
{
signatureChecker.process( new File( files[j] ) );
}

This 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?

@Marcono1234
Copy link
Contributor Author

Marcono1234 commented Mar 28, 2023

@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 xvik/gradle-animalsniffer-plugin#25)

Or did you close this issue by accident?

@slachiewicz slachiewicz reopened this Mar 29, 2023
@slachiewicz
Copy link
Member

Ok, by mistake only - cleanup. Pr welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants