> This PR adds a new JDK tool, called `jnativescan`, that can be used to find 
> code that accesses native functionality. Currently this includes `native` 
> method declarations, and methods marked with `@Restricted`.
> 
> The tool accepts a list of class path and module path entries through 
> `--class-path` and `--module-path`, and a set of root modules through 
> `--add-modules`, as well as an optional target release with `--release`.
> 
> The default mode is for the tool to report all uses of `@Restricted` methods, 
> and `native` method declaration in a tree-like structure:
> 
> 
> app.jar (ALL-UNNAMED):
>   main.Main:
>     main.Main::main(String[])void references restricted methods:
>       java.lang.foreign.MemorySegment::reinterpret(long)MemorySegment
>     main.Main::m()void is a native method declaration
> 
> 
> The `--print-native-access` option can be used print out all the module names 
> of modules doing native access in a comma separated list. For class path 
> code, this will print out `ALL-UNNAMED`.
> 
> Testing: 
> - `langtools_jnativescan` tests.
> - Running the tool over jextract's libclang bindings, which use the FFM API, 
> and thus has a lot of references to `@Restricted` methods.
> - tier 1-3

Jorn Vernee has updated the pull request with a new target base due to a merge 
or a rebase. The incremental webrev excludes the unrelated changes brought in 
by the merge/rebase. The pull request contains 29 additional commits since the 
last revision:

 - Merge branch 'master' into jnativescan
 - ofInvokeInstruction
 - use instance resolveAndBind + use junit in tests
 - de-dupe on path, not module name
 - Add support for module directories + class path directories
 - sort output for easier diffs
 - Jan comments
 - add extra test for missing root modules
 - review comments Alan
 - update man page header to be consisten with the others
 - ... and 19 more: https://git.openjdk.org/jdk/compare/a27659e6...1d1ff010

-------------

Changes:
  - all: https://git.openjdk.org/jdk/pull/19774/files
  - new: https://git.openjdk.org/jdk/pull/19774/files/5afb3561..1d1ff010

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=19774&range=11
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=19774&range=10-11

  Stats: 36188 lines in 816 files changed: 23655 ins; 8432 del; 4101 mod
  Patch: https://git.openjdk.org/jdk/pull/19774.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/19774/head:pull/19774

PR: https://git.openjdk.org/jdk/pull/19774

Reply via email to