RFR: JDK-8300241: Replace NULL with nullptr in share/classfile/
Coleen Phillimore
coleenp at openjdk.org
Tue Jan 24 22:56:09 UTC 2023
On Tue, 24 Jan 2023 22:28:01 GMT, Johan Sjölen <jsjolen at openjdk.org> wrote:
>> Hi, this PR changes all occurrences of NULL to nullptr for the subdirectory share/classfile/. Unfortunately the script that does the change isn't perfect, and so we
>> need to comb through these manually to make sure nothing has gone wrong. I also review these changes but things slip past my eyes sometimes.
>>
>> Here are some typical things to look out for:
>>
>> 1. No changes but copyright header changed (probably because I reverted some changes but forgot the copyright).
>> 2. Macros having their NULL changed to nullptr, these are added to the script when I find them. They should be NULL.
>> 3. nullptr in comments and logs. We try to use lower case "null" in these cases as it reads better. An exception is made when code expressions are in
>> a comment.
>>
>> An example of this:
>>
>> ```c++
>> // This function returns null
>> void* ret_null();
>> // This function returns true if *x == nullptr
>> bool is_nullptr(void** x);
>>
>>
>> Note how `nullptr` participates in a code expression here, we really are talking about the specific value `nullptr`.
>>
>> Thanks!
>
> src/hotspot/share/classfile/classFileParser.cpp line 796:
>
>> 794: // of table since we don't expect Symbol*'s to move.
>> 795: static bool put_after_lookup(const Symbol* name, const Symbol* sig, NameSigHash** table) {
>> 796: assert(name != nullptr, "name in constant pool is nullptr");
>
> Change to null in string!
Suggestion:
assert(name != nullptr, "name in constant pool is null");
> src/hotspot/share/classfile/classFileParser.cpp line 895:
>
>> 893: const InstanceKlass* const k = _local_interfaces->at(index);
>> 894: name = k->name();
>> 895: // If no duplicates, add (name, null) in hashtable interface_names.
>
> Maybe nullptr better here?
Suggestion:
// If no duplicates, add (name, nullptr) in hashtable interface_names.
> src/hotspot/share/classfile/javaClasses.cpp line 4475:
>
>> 4473:
>> 4474: ClassLoaderData* java_lang_ClassLoader::loader_data_acquire(oop loader) {
>> 4475: assert(loader != nullptr, "loader must not be nullptr");
>
> Fix nullptr in string
Suggestion:
assert(loader != nullptr, "loader must not be null");
> src/hotspot/share/classfile/javaClasses.cpp line 4481:
>
>> 4479:
>> 4480: ClassLoaderData* java_lang_ClassLoader::loader_data(oop loader) {
>> 4481: assert(loader != nullptr, "loader must not be nullptr");
>
> Fix nullptr in string
Suggestion:
assert(loader != nullptr, "loader must not be null");
> src/hotspot/share/classfile/javaClasses.cpp line 4487:
>
>> 4485:
>> 4486: void java_lang_ClassLoader::release_set_loader_data(oop loader, ClassLoaderData* new_data) {
>> 4487: assert(loader != nullptr, "loader must not be nullptr");
>
> Fix nullptr in string
Suggestion:
assert(loader != nullptr, "loader must not be null");
> src/hotspot/share/classfile/modules.cpp line 62:
>
>> 60:
>> 61: static bool verify_package_name(const char* package_name, int len) {
>> 62: assert(package_name != nullptr, "Package name derived from non-null jstring can't be nullptr");
>
> Fix nullptr in string
Suggestion:
assert(package_name != nullptr, "Package name derived from non-null jstring can't be null");
-------------
PR: https://git.openjdk.org/jdk/pull/12030
More information about the hotspot-dev
mailing list