-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Make JarTypeSolver and ReflectionTypeSolver a bit more versatile. #4716
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
Make JarTypeSolver and ReflectionTypeSolver a bit more versatile. #4716
Conversation
…iles Java class paths support loading .class files either from .jar files, or from file hierarchies containing .class files. There's no reason why JarTypeSolver shouldn't be able to do that as well!
In particular, allow selecting the entire Java Class Library, and not just the absolute core JRE classes.
a8b7734
to
cbf34bd
Compare
} | ||
|
||
/** | ||
* Given a apth to class file inside a class file hierarchy, extract the package name from the path. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given a path...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #4716 +/- ##
===========================================
Coverage 58.235% 58.235%
Complexity 2511 2511
===========================================
Files 671 671
Lines 38767 38767
Branches 7034 7034
===========================================
Hits 22576 22576
Misses 13295 13295
Partials 2896 2896
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Path pathToJar = adaptPath("src/test/resources/javaparser-core-2.1.0.jar"); | ||
|
||
// Unpack the jar file into a class hierarchy | ||
Path tempDir = Files.createTempDirectory("jp"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this directory be deleted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to using @TempDir
.
Thanks for this interesting PR. |
@jlerbsc I have addresed your review comments; would you like me to rebase? |
Two improvements to
TypeSolver
:JarTypeSolver
can now also resolves types that live in.class
files hierarchies (think the output fromjavac
), without packaging them in a jar file first.ReflectionTypeSolver
gets more flexible filtering; in particular, a pre-made filter is added for the entire Java Class Library.