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

Added java 9+ compatibility (bugfix & addition) #139

Merged
merged 14 commits into from May 2, 2022

Conversation

Finomosec
Copy link
Contributor

@Finomosec Finomosec commented Jan 19, 2021

This PR fixes:

Finomosec and others added 4 commits August 17, 2020 11:23
- SignatureChecker: upgraded from ASM5 to ASM7
- ClassFileVisitor: added ability to process Paths (nedded for "jrt:/modules")
- SignatureBuilder: added java version switch (<=8 / >=9) and implemented signature creation for java 9+
Inner classes need to be processed first. By using a TreeSet, the files are automatically sorted with inner classes first. eg. like "Outer$Inner.class" before "Outer.class"
@Finomosec Finomosec changed the title Added java 9+ compatibility Added java 9+ compatibility (bugfix & addition) Jan 19, 2021
@olamy olamy added the bug label Jan 25, 2021
Copy link
Contributor

@Marcono1234 Marcono1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would be more efficient to directly process the files in postVisitDirectory​(...) and create the files set in preVisitDirectory​(...). Otherwise when there are a lot of classes to process the files set would become rather large, though it might not matter that much because insertion cost is log(n).

@Finomosec
Copy link
Contributor Author

Maybe it would be more efficient to directly process the files in postVisitDirectory​(...) and create the files set in preVisitDirectory​(...). Otherwise when there are a lot of classes to process the files set would become rather large, though it might not matter that much because insertion cost is log(n).

I fixed this as suggested, as well as the other points.

Copy link
Contributor

@Marcono1234 Marcono1234 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good. I have left some more minor review comments.

# Conflicts:
#	animal-sniffer/src/main/java/org/codehaus/mojo/animal_sniffer/ClassFileVisitor.java
#	animal-sniffer/src/main/java/org/codehaus/mojo/animal_sniffer/Main.java
@TimvdLippe
Copy link

This PR appears to reference #131 which per #172 (comment) might also fix #172 which in turn is blocking Mockito from upgrading our version: mockito/mockito#2470

Can we maybe revive this PR and land the fix? That would be greatly appreciated, thanks for the work on this plugin!

@Finomosec
Copy link
Contributor Author

Finomosec commented Apr 28, 2022

From my side all looks good. Can you please merge it? Marcono1234

@Marcono1234
Copy link
Contributor

From my side all looks good. Can you please merge it? Marcono1234

I am not a member of this project. Sorry for the confusion in case my review on this pull request made it look otherwise. Hopefully my review was still helpful and not too intrusive.

To get this merged you probably have to address @olamy or @slachiewicz.


This PR appears to reference #131

@TimvdLippe, I think this PR here is unrelated to #131 (unless I am overlooking something); maybe xvik/gradle-animalsniffer-plugin#25 (comment) caused some confusion because it referenced both issues.

@Finomosec
Copy link
Contributor Author

@olamy @slachiewicz can you please merge this PR?

@slachiewicz
Copy link
Member

Could you help me, please squash to one commit, I'll review after weekend

throw exc;
}
for (final Path file : files) {
try (final InputStream inputStream = Files.newInputStream(file)) {
Copy link
Member

@olamy olamy May 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit.: why final? not sure if it helps anything here

Copy link
Contributor Author

@Finomosec Finomosec May 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not intentional. Not harmful. It does not change the behavior here.

In my company we decided to make anything final, that can be final.
It's supposed to make the semantics of the code clearer when reading code.

Remove the finals if you want.

p.s. thanks for the merge.

@olamy olamy merged commit 29e3e4b into mojohaus:master May 2, 2022
@TimvdLippe
Copy link

@olamy do you mind publishing a release with this bugfix?

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

Successfully merging this pull request may close these issues.

None yet

5 participants