RFR: 8317611: Add a tool like jdeprscan to find usage of restricted methods [v2]

Jorn Vernee jvernee at openjdk.org
Wed Jun 19 19:04:12 UTC 2024


On Wed, 19 Jun 2024 17:45:14 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

>> src/jdk.jdeps/share/classes/com/sun/tools/jnativescan/RestrictedMethodFinder.java line 120:
>> 
>>> 118:             Optional<ClassResolver.Info> info = systemClassResolver.lookup(methodRef.owner());
>>> 119:             if (!info.isPresent()) {
>>> 120:                 return false;
>> 
>> Is this just `false` or maybe a warning that a certain owner could not be resolved (maybe if running with enough debug options) ?
>
> Yes, thought about that yesterday as well. Good catch

Thinking a bit more: we also use the optional being empty to know if the owner is not a system class, so I think this code here is what we want. We can however throw an exception if a class is not found in `SystemClassResolver::lookup`. Since, if a class is inside a system module package, it should be found as well (unless the user sets the release to the wrong version).

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

PR Review Comment: https://git.openjdk.org/jdk/pull/19774#discussion_r1646606901


More information about the build-dev mailing list