RFR: 8298065: Provide more information in message of NoSuchFieldError [v7]
Ioi Lam
iklam at openjdk.org
Tue Jan 10 06:21:53 UTC 2023
On Tue, 10 Jan 2023 03:58:59 GMT, David Holmes <dholmes at openjdk.org> wrote:
>> I think Matias's version is more grammatically correct. Maybe we should rename the two existing functions
>>
>>
>> symbol.hpp: void print_as_signature_external_return_type(outputStream *os);
>> symbol.hpp: void print_as_signature_external_parameters(outputStream *os);
>>
>>
>> to `print_signature_as_xxx`.
>
> These are methods on VMSymbol that print the VMSymbol as a signature, so the naming is correct.
Sorry I am a bit obsessed with names.
The two existing methods are used only for method signatures. They each print *a portion* of the signature. For example, when given a signature like "(ZI)J":
- print_as_signature_external_parameters() prints `boolean, int`. Note that the parentheses aren't printed
- print_as_signature_external_return_type() prints `long`
Matias's new function is used only for field signatures. David's suggestion of "print_as_signature_external_field_type" is not consistent with the existing names (which do not say "method").
While "print_as_signature_external_parameters()" can be read as "print the parameters of a (method) signature in external format", I think it's clumsy and incomplete. How about:
- print_method_signature_parameters()
- print_method_signature_return_type()
- print_field_signature_type()
I think the word "external" is confusing and can be skipped. For method signatures, we don't need methods that just print the parameters in their internal format (i.e., `ZI` or `L`), so there's no need to distinguish these functions from "internal" ones.
Also, the first two methods should assert `Signature::is_method(this)` and the last one should assert `!Signature::is_method(this)` .
-------------
PR: https://git.openjdk.org/jdk/pull/11745
More information about the hotspot-runtime-dev
mailing list