-
Notifications
You must be signed in to change notification settings - Fork 9
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
Class files are processed in non-deterministic order causing issues for nested classes #25
Comments
Thank you for the detailed report! I did manual sorting so now everything would work (I checked on mockito - it works). 1.5.2 released. But I did not update animalsiffer itself to the latest 1.19 (as before, plugin will use 1.18 by default). If you'll try to update it on mockito: animalsniffer {
sourceSets = [sourceSets.main]
annotation = 'org.mockito.internal.SuppressSignatureCheck'
toolVersion = '1.19'
} You'll notice additional errors:
It's something related to animalsniffer itself (probably a regression). Sorry, did not look into it. |
Thank you very much for this fast response and release! I have also created mojohaus/animal-sniffer#130 in case animal-sniffer is actually misbehaving and should sort the file names from
I had not actually tried upgrading animal-sniffer yet, but I am now indeed seeing the same errors. Though it looks like the changes to use |
131 would probobly help to suppress new errors, but the problem is that these errors do not specify the exact source location (code line like It looks like an "echo" of already suppressed errors. Not normal. |
Ah sorry, I should have mentioned that I debugged through animal-sniffer and it appears the new errors are coming from the newly introduced |
Just for your information, mojohaus/animal-sniffer#212 has been merged, so once these changes are released and you upgrade your dependency, you might have to adjust your parsing logic in |
always put line number in file report, even if it wasn't declared (consistency with console reporting)
Thank you for the info! |
When this plugin runs animalsniffer's
org.codehaus.mojo.animal_sniffer.ant.CheckSignatureTask.execute()
, it appearsCheckSignatureTask.paths
contains a singleorg.apache.tools.ant.types.Path
which lists all class files (noticed this when remote-debugging Gradle). The problem is that these class files are listed in a non-deterministic order. This is problematic because animal-sniffer must first process enclosing classes before processing any nested classes. Otherwise it can happen that a forbidden API usage is detected in a nested class despite the enclosing class being annotated.This occurrs for me reliably when building
mockito/mockito
(which uses this Gradle plugin) on Windows. There it always finds forbidden API usage inInlineByteBuddyMockMaker$1
despite the enclosing class being annotated, but for every other class the annotation works as expected (has also been mentioned in mockito/mockito#2024). Changing the class file name toAInlineByteBuddyMockMaker$1.class
(prefixedA
) still reproduces it, whileZInlineByteBuddyMockMaker$1.class
(prefixedZ
) causes the issue to disappear (when running./gradlew animalsnifferMain -x compileJava
). This only occurs on Windows, but apparently not on Linux.I am not familiar with Groovy which is why I have not found out / understood how
CheckSignatureTask.paths
is populated by this Gradle plugin, or how Ant'sPath
is supposed to be used. If thePath
is supposed to contain all class file paths (instead of only the source directory), then this is probably an animal-sniffer bug here (and I will report it in their repository) because everywhere else they are sorting the file paths (e.g. here) to make sure enclosing classes are processed first.Please let me know what you think or if you need additional information.
The text was updated successfully, but these errors were encountered: