Make JarTypeSolver and ReflectionTypeSolver a bit more versatile.#4716
Make JarTypeSolver and ReflectionTypeSolver a bit more versatile.#4716jlerbsc merged 5 commits intojavaparser:masterfrom
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. |
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.
Will this directory be deleted?
There was a problem hiding this comment.
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:JarTypeSolvercan now also resolves types that live in.classfiles hierarchies (think the output fromjavac), without packaging them in a jar file first.ReflectionTypeSolvergets more flexible filtering; in particular, a pre-made filter is added for the entire Java Class Library.