-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Description
Feature request
Besides the innovation of native image, GraalVM is a state-of-the-art static analysis framework as well. Currently there is no other Java static analysis framework can do points-to analysis as well and practically as GraalVM does. People from both industry and academia are looking for good Java static analysis tool for security analysis, code quality analysis and etc., but can't find a proper one. Making static analysis available for universal Java program can further expand GraalVM's influence and attract more people to the community.
However, the current analysis result from GraalVM is only applicable for native image, not for traditional Java programs, because the static analysis framework is cohered with native image features, including but not limited:
- Class pre-initialization: In native image, Core JDK classes are preinitialized so that their
<clinit>s are free from analysis, so the methods and fields accesses only from these<clinit>s are not taken as reachable. There will be less reachable methods and fields reported than it should be for traditional Java program. - Class substitution: Many JDK classes are substituted, so the analysis results are different from original classes.
Describe the solution you'd like.
We will propose several commits to adapt the static analysis framework for universal Java program, including:
- An automatic feature to report the static analysis result to a json file
- Disable class substitution for analysis
- Analyze class pre-initialization safety status without initializing all core JDK classes at BUILD_TIME
- Simplify the setup phase. Skip initialization work not required by analysis phase
We would like to contribute the code to the upstream in a branch as a start point, so that any one who is interested in this feature can collaborate with us to make the solution more sophisticated.
Describe who do you think will benefit the most.
- Java users who need a sophisticated points-to analysis as a base for various further static analysis.
- Java users who need to find all possible pre-initializing classes for Java program startup optimization.
This feature can turn these Java users into GraalVM users.