RFR: 8311500: StackWalker.getCallerClass() throws UOE if invoked reflectively [v3]

Volker Simonis simonis at openjdk.org
Fri Jul 14 09:38:58 UTC 2023


On Fri, 14 Jul 2023 08:39:44 GMT, ExE Boss <duke at openjdk.org> wrote:

>> Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fixed case when calling getCallerClass() from a @CallerSensitive method reflectively
>
> src/hotspot/share/prims/stackwalk.cpp line 164:
> 
>> 162:     method->method_holder()->is_subtype_of(constructor_accessor) ||
>> 163:     // MethodHandle frames are not hidden and StackWalker::getCallerClass has to filter them out
>> 164:     method->method_holder()->name()->starts_with("java/lang/invoke"));
> 
> Shouldn’t this be:
> Suggestion:
> 
>     method->method_holder()->name()->starts_with("java/lang/invoke/"));

Thanks, you're right, this is a copy/paste error. It currently doesn't make any difference, until somebody introduces a new package in `java.lang` that starts with `invoke*` :)

Fixed locally, will be in the next commit.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14773#discussion_r1263522481


More information about the core-libs-dev mailing list