RFR: 8298065: Provide more information in message of NoSuchFieldError [v7]

David Holmes dholmes at openjdk.org
Mon Jan 9 22:21:57 UTC 2023


On Fri, 6 Jan 2023 23:39:08 GMT, Matias Saavedra Silva <matsaave at openjdk.org> wrote:

>> A java.lang.NoSuchFieldError is typically thrown when you remove a field but do not recompile the client code that calls the field. However, the message does not indicate in which class the field was not found. 
>> 
>> Additionally, java.lang.NoSuchFieldError is thrown if the field is still present but the types are incompatible. For example, if a field is first defined as int, and later changed to long without recompiling the client. The error text has been expanded to include the class name and field type. Verified with tier 1-4 tests.
>> 
>> Old output:
>> `Exception in thread "main" java.lang.NoSuchFieldError: x
>>         at NoSuchFieldMain.main(NoSuchFieldMain.java:3)`
>> Example output:
>> `Exception in thread "main" java.lang.NoSuchFieldError: Class Other does not have field 'int x'
>>         at NoSuchFieldMain.main(NoSuchFieldMain.java:3)`
>> 
>> The added test considers different types of fields like primitives, arrays, and references.
>
> Matias Saavedra Silva has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Simplified jasm test cases

src/hotspot/share/oops/symbol.hpp line 278:

> 276:   //  'double' or 'java.lang.Object[][]'.
> 277:   void print_as_signature_external_parameters(outputStream *os);
> 278:   void print_signature_as_external_field_type(outputStream *os);

Should this be `print_as_signature_external_field_type`?

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

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


More information about the hotspot-runtime-dev mailing list